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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SORTING

Author  Topic 

k_cire0426
Yak Posting Veteran

63 Posts

Posted - 2009-03-17 : 17:13:53
Hi,

Does anyone could please tell me why does the query below doesn't sort?

Select * from
(
Select top 100 percent * from tbl order by column
) as tbl


Thanks in Advanced.

k_cire0426
Yak Posting Veteran

63 Posts

Posted - 2009-03-18 : 11:18:07
anyone?
Go to Top of Page

BJM RAO
Starting Member

20 Posts

Posted - 2009-03-20 : 13:09:14
Order by is to be specified on a column name , and name of the column cant be column view key word


Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-20 : 13:21:51
quote:
Originally posted by k_cire0426

Hi,

Does anyone could please tell me why does the query below doesn't sort?

Select * from
(
Select top 100 percent * from tbl order by column
) as tbl


Thanks in Advanced.


what about this?

Select * from
(
Select top 100 percent * from tbl
) as tbl
order by column
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-03-21 : 04:16:47
quote:
Originally posted by visakh16

quote:
Originally posted by k_cire0426

Hi,

Does anyone could please tell me why does the query below doesn't sort?

Select * from
(
Select top 100 percent * from tbl order by column
) as tbl


Thanks in Advanced.


what about this?

Select * from
(
Select top 100 percent * from tbl
) as tbl
order by column



In this case you dont need top 100 percent

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -