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 2000 Forums
 Transact-SQL (2000)
 correlated sub query

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-06-26 : 09:52:39
srinivas ashok writes "please get me a code on

how to get the top 10 persons salary (a correlated sub query)"

M.E.
Aged Yak Warrior

539 Posts

Posted - 2002-06-26 : 10:15:08
select top 10 personssalary from salarytable order by personsalary desc

If ya want anything more, you'll have to post the ddl for your tables (the create statement)

-----------------------
Take my advice, I dare ya
Go to Top of Page

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2002-06-26 : 11:59:27
Sounds like you're after a derived table, as in:

SELECT TOP 10 Persons
FROM
( SELECT...FROM ...WHERE... ) as SubTbl
ORDER BY ...
Go to Top of Page
   

- Advertisement -