[thelist] SQL Challenge Question
Anthony Baratta
Anthony at Baratta.com
Mon Oct 27 19:47:57 CST 2003
At 02:32 PM 10/27/2003, Rob Smith wrote:
>Hi,
>
>I've got an SQL Challenge for you.
>
> Given: Two nearly Identical Rows
> Problem: Isolate the columns where the data
> is not the same.
> Solution: ?
If you are only interested in check each row itself:
select * from table where col1 <> col2.
if you want to find those values in all of col1 not in col2
select * from table where col1 not in (select col2 from table)
reverse for other way
select * from table where col2 not in (select col1 from table)
there are other ways by joining the table to itself.
---
Anthony Baratta
President
Keyboard Jockeys
"Conformity is the refuge of the unimaginative."
More information about the thelist
mailing list