Re: Selct DISTINCT
From: <trpost_at_gmail.com>
Date: Tue, 29 Jan 2008 12:29:28 -0800 (PST)
Message-ID: <6aa4f594-c6df-4da2-a50b-a9a4adda0c90@e4g2000hsg.googlegroups.com>
Date: Tue, 29 Jan 2008 12:29:28 -0800 (PST)
Message-ID: <6aa4f594-c6df-4da2-a50b-a9a4adda0c90@e4g2000hsg.googlegroups.com>
Let me expand a little on what I am actually doing, I provided a small
example in the original post as I thought there might be a simple way
to select the first distinct row based on one column.
Without specifics, here is how my query is structured:
SELECT DISTINCT(ID), NAME, SSN FROM
(
SELECT DISTINCT(ID), NAME, SSN FROM TABLE1 UNION ALL SELECT DISTINCT(ID), NAME, SSN FROM TABLE2 )
So the problem I have is that there is some duplicate data in TABLE1 and TABLE2, but TABLE1 data always has more data available then in TABLE2, so that is how I know if there is a duplicate to take the first row. Received on Tue Jan 29 2008 - 14:29:28 CST