Jason Minton
asked on
Simple Oracle SQL query help needed
I need all id's in table1 that are not in table2 after a specific date.
table1:
id
table2:
date
id
I need to know all of the id's in table 1 that do not appear in table2 with a date greater than 1/1/07 for example.
This is an Oracle db.
table1:
id
table2:
date
id
I need to know all of the id's in table 1 that do not appear in table2 with a date greater than 1/1/07 for example.
This is an Oracle db.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Here were my results:
mbizup: no results returned
slightwv: seems to return opposite of what I want. I probably could just reverse it and get what I want.
sathyagiri: this seems to work.
Thank you...
mbizup: no results returned
slightwv: seems to return opposite of what I want. I probably could just reverse it and get what I want.
sathyagiri: this seems to work.
Thank you...
>>seems to return opposite of what I want.
oops. Yes, just reverse the minus and it should work.
You should run an explainn plan on both to see which works best in your database. My money is on the 'minus' query.
oops. Yes, just reverse the minus and it should work.
You should run an explainn plan on both to see which works best in your database. My money is on the 'minus' query.
ASKER
Thanks I will... This is just a one time (manual) data extract though, so not a big deal really.
FROM Table1 LEFT JOIN Table2 ON Table1.ID = Table2.ID
WHERE Table2.ID IS NULL AND Table1.Date > [SomeDate]