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
 SQL Server Development (2000)
 Removing duplicates and creating subqueries

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-02-28 : 08:18:07
Yehudit writes "Hi,
I have a data table with various columns: ID, Lot, Well, Plate. There are several dupliate ID numbers (each having a different lot numnber). There rest of the columns are distinct. For ex.

ID Lot
1000 1
1000 2
1000 3

I would like to write an SQL code that would first, run a query to select the data points according to certain criteria. Second, it would eliminate the duplicate rows with the same ID (leaving only one per ID) and return the remaining data points for all the columns. I tried wrting the following, but it did not work:

SELECT distributions.ID, distributions.Lot, distributions.Well,
distributions.Plate
FROM distributions
WHERE (((distributions.Plate)<1000) AND ((distributions.Well >30))
ORDER BY distributions.date, distributions.Biocept
IN (SELECT DISTINCT distributions.ID
FROM distributions)

Thank you for your assistance.
Yehudit"

Nazim
A custom title

1408 Posts

Posted - 2002-02-28 : 08:28:38
Graz has written a Article on eliminating duplicates.

Check it , it might help you http://www.sqlteam.com/item.asp?ItemID=3331.





--------------------------------------------------------------
Go to Top of Page
   

- Advertisement -