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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 sorts the column without keyword Order By

Author  Topic 

teamjai
Yak Posting Veteran

52 Posts

Posted - 2013-01-24 : 02:31:39
By default, ORDER BY sorts the column in ascending order.

i need to sort the column Without ORDER BY keyword in the SQL query, is it possible in SQL server 2008

Eg:
Select Seq.No from Student Order By Seq.No

it display Seq.No in Asc order.

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-01-24 : 02:42:24
GROUP BY clause also sorts the results. Difference is duplicates will be removed from the list

If there is no duplicates for the column Seq.No , then GROUP BY will also give result in ascending order

1) Select Seq.No from Student Order By Seq.No

2) Select Seq.No from Student GROUP By Seq.No



--
Chandu
Go to Top of Page

teamjai
Yak Posting Veteran

52 Posts

Posted - 2013-01-24 : 03:15:31
Thanks..

But i need use only "Where".
Using "where" keyword sorts the results. is it possible?
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2013-01-24 : 03:40:12
NO, there is no reliable order without using ORDER BY!


Too old to Rock'n'Roll too young to die.
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-01-24 : 03:45:31
quote:
Originally posted by teamjai

Thanks..
But i need use only "Where".
Using "where" keyword sorts the results. is it possible?

I guess that is not possible....

--
Chandu
Go to Top of Page
   

- Advertisement -