Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
2.60/5 (4 votes)
See more:
the format i am getting is..
name | rollno |subject
ta bca2 ds
gg bca4 ds
asd bca5 ds
aa bca6 ds
gg bca7 ds
aaa bca8 ds
daa bca3 dm
asd bca5 dm
aa bca6 dm
gg bca7 dm
aaa bca8 dm
bag bca1 gd
daa bca3 gd
gg bca7 gd
asd bca5 fds


i used "order by sroll". since it is in loop the result i am getting is as above. but i need second column should be sorted along with other data.

can any one help me?
Posted
Updated 17-Feb-14 17:10pm
v3
Comments
sohail awr 19-Feb-14 7:39am    
While your second column name is 'rollno' so how can you 'order by sroll'. Please give exact name of your 2nd column so that your data will be sorted out automatically.

****

If you are selecting data like (Select name + ' ' + rollno + ' ' + subject as test1 from table1 order by rollno) it will also give sorted result.

****

If you want to sort data by two or more columns so use this query
Select * from table1 order by rollno, name

1 solution

If you are filling data through selection query please do this.

SQL
Select * from table1 order by rollno
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900