General information
Category:
Coding, syntax & commands
>hello,
> Could someone help me with this problem: there are two tables. I am trying to use delete sql to delete records from table #2 which are not in table #1. This is my statement:
>DELETE FROM CANCALL WHERE !HANDLER IN(SELECT HANDLER FROM CANCALL WHERE INLIST(HANDLER,"915","100","985")) AND !AG_ID IN(SELECT AG_ID FROM CANCALL WHERE INLIST(AG_ID, "900240","900740","901320"))
>
>the records I try to delete are handler = 915 and ag_id = 90024; handler = 100 and ag_id = 900740. thanks
>sherry
No need for subselects here since the selections can be resolved all in one table. Try:
DELETE FROM cancall WHERE ;
INLIST(handler,"915","100","985") AND ;
INLIST(ag_id,"900240","900740","901320")
This will mark for deletion for nine possible combinations of handler and ag_id including the two you specified.
hth
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only