Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-05-13 : 08:11:56
|
| Franceene writes "I am working w/ a table that has a column of type decimal, and the others are varchar. Using the following crosstab query w/ the varchars and they work fine... but w/ the decimal I modify it, but it's still not working.. Please see my examples below.. THANKSQUERY:For varcharSELECT LATA, NPA, NXX, Range,ST,Rank_1=MAX(substring(Company,1,datalength(Company)*(CASE Rank when 1 then 1 else 0 END))),For DecimalSELECT LATA, NPA, NXX, Range,ST,Rate_1=SUM(Rate)*(CASE Rank when 1 then 1 else 0 END),RESULT:Ie. LATA | NPA | NXX | Range | ST | Rate_1 |1111 121 213 23 ME .451111 121 213 23 ME .001111 121 213 23 ME .00I don't want there to be more than one instance of each record.. each record has up to 12 rate(s) range(s)..Any ideas would be awesome..THANKS" |
|
|
robvolk
Most Valuable Yak
15732 Posts |
|
|
|
|
|
|
|