dbTalk Databases Forums  

sorting table

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss sorting table in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Oonz
 
Posts: n/a

Default sorting table - 05-15-2007 , 05:34 AM






Hi friends,

please help me in sorting this table. the table should be sorted based
on LASTNAME, and then the ID (only non-zero id should be sorted).


ID LASTNAME
--------+----------------------------
2 FFF
1 XXX
0 CCC
1 DDD
2 BBB
0 EEE
0 GGG
3 III
3 HHH
4 ZZZ
4 ZZZ




The expected table is as follows
ID LASTNAME
--------+----------------------------
2 BBB
2 FFF
0 CCC
1 DDD
1 XXX
0 EEE
0 GGG
3 HHH
3 III
4 XYZ
4 ZZZ

should be sorted based on last name and should be grouped with the
same ID, except for the ID as 0

Thanks in Advance..
Arun


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.