Home » SQL & PL/SQL » SQL & PL/SQL » sql to display record from T1 not found in T2
sql to display record from T1 not found in T2 [message #315437] Mon, 21 April 2008 08:53 Go to next message
Raoul
Messages: 20
Registered: April 2005
Junior Member
Hi

Could someone please help with the following.
I have 2 tables T1 and T2 each has 3 key fields and the key fields in the 2 tables are the same. I need to run a query that displays the records that are in T1 but not in T2.

Many thanks
Raoul
Re: sql to display record from T1 not found in T2 [message #315440 is a reply to message #315437] Mon, 21 April 2008 08:55 Go to previous messageGo to next message
S.Rajaram
Messages: 1027
Registered: October 2006
Location: United Kingdom
Senior Member
Answer lies in your question. So re-read your question and search in the oracle reference manual for the right keyword. For example not in.

Regards

Raj
Re: sql to display record from T1 not found in T2 [message #315441 is a reply to message #315437] Mon, 21 April 2008 08:56 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
MINUS

Regards
Michel
Re: sql to display record from T1 not found in T2 [message #315442 is a reply to message #315437] Mon, 21 April 2008 08:56 Go to previous messageGo to next message
joy_division
Messages: 4643
Registered: February 2005
Location: East Coast USA
Senior Member
Use MINUS.
Re: sql to display record from T1 not found in T2 [message #315443 is a reply to message #315441] Mon, 21 April 2008 08:57 Go to previous messageGo to next message
S.Rajaram
Messages: 1027
Registered: October 2006
Location: United Kingdom
Senior Member
I always tend to miss the most obvious "set operator". It was one of my interview question. After so many clues in the end I managed to answer what they are expecting.

Regards
Re: sql to display record from T1 not found in T2 [message #315447 is a reply to message #315437] Mon, 21 April 2008 09:12 Go to previous messageGo to next message
Raoul
Messages: 20
Registered: April 2005
Junior Member
There is always someone who thinks he is smarter than the rest.
Many thanks to those who replied with an answer.
God bless you.
Re: sql to display record from T1 not found in T2 [message #315494 is a reply to message #315447] Mon, 21 April 2008 13:21 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Yet there are always some that don't recognize a wise advise when they're given one.

And may the FSM touch you with his noodleyness.
Previous Topic: Optimal plan Versus Execution plan
Next Topic: Char Versus Varchar
Goto Forum:
  


Current Time: Thu Dec 08 16:19:59 CST 2016

Total time taken to generate the page: 0.10477 seconds