Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sql statement
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00543226
Message ID:
00543276
Views:
15
>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
Map
View

Click here to load this message in the networking platform