SQL Language (MOSC)

MOSC Banner

write a query to select records from one table that are not in another.

edited Apr 1, 2012 10:04PM in SQL Language (MOSC) 8 comments

how do I reverse  this query?

select part_no from parts_to_load
minus
select part_no from inv_part
where contract = upper('&v_contract')
and create_date > (sysdate - 1);

this query tells me what part_no(s) are not in inv_part
for a contract and the last 24 hours.


I will get an output of

part_no
-------
12
12d
bd23

and so on....



Describe tables:

create table inv_part (
part_no varchar2(25) not null,
contract varchar2(5) not null,
create_date date
);

create table parts_to_load (
part_no varchar2(25) not null
);


What I want is:

select part_no, contract, create_date from inv_part

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center