Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sql statement
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00543226
Message ID:
00543276
Vues:
14
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform