Home » SQL & PL/SQL » SQL & PL/SQL » compare
compare [message #209991] Mon, 18 December 2006 19:58 Go to next message
pisanari
Messages: 1
Registered: December 2006
Junior Member
Hi,

I have a table with two columns (both varchars). COL1 and COL2. I need to do the following

compare each and every element of col1 with col2 if match is found ignore it else show it. Appreciate if you can help me with a query

example

COL1 COL2
a b
b c
f d
f

the query result should be a,c and d

thanks in advance

[Updated on: Mon, 18 December 2006 19:59]

Report message to a moderator

Re: compare [message #210016 is a reply to message #209991] Mon, 18 December 2006 23:20 Go to previous message
rameshuddaraju
Messages: 69
Registered: June 2005
Location: India
Member




SELECT COL1 FROM YOUR_TABLE WHERE COL1 NOT IN (SELECT COL2 FROM YOUR_TABLE)
UNION
SELECT COL2 FROM YOUR_TABLE WHERE COL2 NOT IN (SELECT COL1 FROM YOUR_TABLE);
Previous Topic: CHECK data type in SQL
Next Topic: TRIGGER
Goto Forum:
  


Current Time: Sat Dec 03 09:46:58 CST 2016

Total time taken to generate the page: 0.08363 seconds