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 |
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-01-08 : 01:44:04
|
Hi,I have a table test having the following valuesno desc 1 name11 test1 data2 xyz3 temp3 regularNow I want to display the same in the following wayno desc 1 name1 test data2 xyz3 temp regularI used the queryselect (Select no from test where no=t.no group by no having count(no) =1), desc from test t order by nobut it produced the resultno desc null name1null testnull data2 xyznull tempnull regularIs there any solution?Madhivanan |
|
Kristen
Test
22859 Posts |
Posted - 2005-01-08 : 06:42:15
|
[code]SELECT CASE WHEN EXISTS (SELECT * FROM test T2 WHERE T2.no = T1.no AND T2.desc > T1.desc) THEN NULL ELSE no END, descFROM test T1ORDER BY no, desc[/code]Kristen |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-01-08 : 07:27:10
|
Thanks Kristan. It works wellMadhivanan |
|
|
|
|
|