January 5, 2010 at 2:57 am
i have a table like..
column1 column2 column3
a a 002
a a 003
a a 001
b b 002
b b 003
b b 001
i need like this.....
column1 column2 column3
a a 001
a a 002
a a 003
b b 001
b b 002
b b 003
help me.....
January 5, 2010 at 3:08 am
Hi,
Desired order by is not possible or you post the wrong output.
However, you just use the normal order by class
Select * from MYTABLE
Order by col1, col2, col3
col1|col2|col3
A|A|001
A|B|002
A|C|003
B|A|003
B|B|001
B|C|002
January 5, 2010 at 3:08 am
What have you tried so far?
Did you check the examples in BOL (Books Online, the SQL Server help system installed together with SQL Server)?
You might want to look for "Sorting Rows", Subtitle: "Sorting Rows with ORDER BY"...
January 5, 2010 at 4:18 am
select * from [table_name] order by column1, column2,column3 should work (even if all the column datatype if varchar)
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply