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 |
|
insanepaul
Posting Yak Master
178 Posts |
Posted - 2010-05-28 : 08:11:13
|
| Hi,I just need to know how to convert row names into columns eg.Does this make sense?Datacustomer...idJames.........1paul..........1Paul..........2James.........3output:id james paul1..........1..........12..........0..........13..........1..........0 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2010-05-28 : 08:23:37
|
| select id,case when customer = 'james' then 1 else 0 end as james,case when customer = 'paul' then 1 else 0 end as paulfrom tablename |
 |
|
|
insanepaul
Posting Yak Master
178 Posts |
Posted - 2010-05-28 : 09:57:32
|
quote: Originally posted by bklr select id,case when customer = 'james' then 1 else 0 end as james,case when customer = 'paul' then 1 else 0 end as paulfrom tablename
Excellent...just what I wanted thanks!!! |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|