PLEASE HELP, URGENT [message #36394] |
Sun, 25 November 2001 17:54 |
NOUSHKA
Messages: 1 Registered: November 2001
|
Junior Member |
|
|
How can I delete the current tuple from 'Items' table where its item_ID does not exist in 'Inventory' table? how can I check it?
where I want to delete a tuple, I have to check another table to see if item_Id of first table exist in Inventory table, if it does not, I delete the tuple from Items table.
----------------------------------------------------------------------
|
|
|
Re: PLEASE HELP, URGENT [message #36395 is a reply to message #36394] |
Sun, 25 November 2001 19:25 |
Rajarshi Dasgupta
Messages: 52 Registered: October 2001
|
Member |
|
|
I am giving U the solution of the first problem..... i.e. "How can I delete the current tuple from 'Items' table where its item_ID does not exist in 'Inventory' table? how can I check it?"
DELETE ITEMS
WHERE ITEM_ID NOT IN (SELECT DISTINCT ITEM_ID
FROM INVENTORY);
Your second query... is confusing.... can U explain it a bit more....
Thanx
----------------------------------------------------------------------
|
|
|
Re: PLEASE HELP, URGENT [message #36398 is a reply to message #36395] |
Sun, 25 November 2001 22:46 |
Rob Baillie
Messages: 33 Registered: November 2001
|
Member |
|
|
Just a note... the DISTINCT isn't needed, and only serves to slow the query down. Avoid DISTINCTs where ever possible.
----------------------------------------------------------------------
|
|
|