CartoonDog
IS-IT--Management
I am have been trying to write a sql statement and could use some help.
I am querying two tables. The first table holds the part numbers called PART. The second holds the transactions for the part table and is called TRANS. I need to find all the parts that have not had any transactions since 1/1/2007. The tables are linked by part number, called ID. The transaction table has the dates of when parts were used.
My initial query looked like this:
select ID from part where
qty_on_hand >0
and qty_on_order <1
and id not IN (select part_id from trans where
where trans.class='I'
and trans.trans_date <'01-JAN-2007');
Ive tried losing the 'NOT' statement and reversing the '<' to no avail!
I am querying two tables. The first table holds the part numbers called PART. The second holds the transactions for the part table and is called TRANS. I need to find all the parts that have not had any transactions since 1/1/2007. The tables are linked by part number, called ID. The transaction table has the dates of when parts were used.
My initial query looked like this:
select ID from part where
qty_on_hand >0
and qty_on_order <1
and id not IN (select part_id from trans where
where trans.class='I'
and trans.trans_date <'01-JAN-2007');
Ive tried losing the 'NOT' statement and reversing the '<' to no avail!