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:
00543301
Vues:
18
This message has been marked as the solution to the initial question of the thread.
I don't see a second table in your example but code below will delete what you specify in your post.
>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"))

I don't see a second table in your example but here's the code assuming that name of table#1 is table1 and it has the same fields names as table#2
DELETE FROM cancall ;
    WHERE handler + ag_id NOT IN ( ;     
      SELECT handler + ag_id FROM table1) 
>
>the records I try to delete are handler = 915 and ag_id = 90024; handler = 100 and ag_id = 900740.

Here's code for this
DELETE FROM cancall ;
    WHERE ( handler = "915"and ag_id = "900240") ;
       OR ( handler = "100"and ag_id = "900740") ;
       OR ( handler = "985"and ag_id = "901320") 
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform