Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I want to select top 10 distinct exposureids

Status
Not open for further replies.

ASmee

IS-IT--Management
Jul 9, 2002
46
US
The following command does not work:

select top 10 (distinct(exposureid)) from iinstrumentid

The table contains duplicate exposureids, so all I want are the top 10 distinct exposureids.
 
the answers is.....

select distinct(exposureid) from iinstrumentidmaster where exposureid in (select top 10 exposureid from iinstrumentidmaster)
 
In this case, you will have the distinct value of the 10 top rows. If the top 10 rows are the same you will get 1 rows.

Try this :
SELECT TOP 10 exposureid
FROM iinstrumentid
GROUP BY exposureid
 
Did you try:
Select distinct top 10 exposureid from instrumentid
 
You could also try

SET ROWCOUNT 10 -- Return only the first 10 rows

SELECT DISTINCT exposureid
FROM instrumentid

SET ROWCOOUNT 0 -- Reset row count to all


Hope of some use

Andy (LokiDBA)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top