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 |
|
amsad
Starting Member
17 Posts |
Posted - 2011-01-12 : 04:04:14
|
Hi guys, Need your help with my problem below,|no_hour| count | sum |type_string| 0 200 300 MMS 0 400 100 GPRS 0 100 120 video . . . . . . . . . . . .i want covert this table like this,just look as one row only..need your help guys.|no_hour| countMMS | sumMMS|type_stringMMS|countGPRS | 0 200 300 MMS 400 sum GPRS|type_stringGPRS| countVideo | sumvideo |type_stringvideo| 100 GPRS 100 120 videoThnk you. Can do. |
|
|
Sachin.Nand
2937 Posts |
Posted - 2011-01-12 : 04:17:17
|
| Is your type_string always be of 3 different values and not more than that ?PBUH |
 |
|
|
amsad
Starting Member
17 Posts |
Posted - 2011-01-12 : 04:27:42
|
quote: Originally posted by Sachin.Nand Is your type_string always be of 3 different values and not more than that ?PBUH
its only 3 values (MMS,GPRS and Video)Can do. |
 |
|
|
amsad
Starting Member
17 Posts |
Posted - 2011-01-12 : 04:28:33
|
quote: Originally posted by Sachin.Nand Is your type_string always be of 3 different values and not more than that ?PBUH
its only 3 values (MMS,GPRS and Video)Can do. |
 |
|
|
amsad
Starting Member
17 Posts |
Posted - 2011-01-12 : 04:28:42
|
quote: Originally posted by Sachin.Nand Is your type_string always be of 3 different values and not more than that ?PBUH
its only 3 values (MMS,GPRS and Video)Can do. |
 |
|
|
Sachin.Nand
2937 Posts |
Posted - 2011-01-12 : 04:38:05
|
No need for 3 replies if you have 3 values for type_string in the tableselect sum(case when type_string='MMS' then sum end)sumMMS,count(case when type_string='MMS' then count end)CountMMSfrom yourtable group by no_hour Do the above for all the values of type_string in the tablePBUH |
 |
|
|
|
|
|