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 |
|
sqldev6363
Yak Posting Veteran
54 Posts |
Posted - 2011-09-12 : 16:22:34
|
| this is how i am doing now---for the name column -----select distinct id,name into #temp1 from table1 where name is not nulland number = 'no1'select distinct id,name into #temp2 from table1 where name is not nulland number = 'no2'select test.id,prod.id,test.name,prod.name from #temp1 as test Inner join #temp2 as prod on test.id = prod.id and test.name != prod.name-- for the city column ----Here also the same query as mentioned above but instead of having name we will put city---------------------------Like this i have 10 columns...instead of writing 10 times of the above script for each column is there any other way we can do it in 1 statement..can any one help me in this..dev |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-09-13 : 01:13:53
|
| so you want the various column values to appear as rows (vertically) or as separte columns (horizontally)? Would appreciate if you can post the desired output format------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|