[thelist] duplicates

Brian Cummiskey Brian at hondaswap.com
Tue Apr 12 09:31:20 CDT 2005


Dan McCullough wrote:
> Is there away in a query to add to the select statement that if there
> is more then one record of the same id not to pull it.

select distinct(id) from tablename

> 
> That might be a bit confusing, but basically I have a summary table of
> categories and products, and a single product can go into multiple
> categories.  So I am pulling certain certain information from the
> summary table and certain information from the product table.  So I
> will get get 2-3 rows that are the same id.

in this case, you need to join the tables...

select distinct(id) from tablename A
left outer join tablename2 B on B.id = A.id




More information about the thelist mailing list