Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to use standard SQL statement
Message
 
À
07/12/2006 13:19:35
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Database:
Visual FoxPro
Divers
Thread ID:
01175780
Message ID:
01175790
Vues:
7
>I have tables
>
>
CREATE CURSOR t1 ( rida c(10), month c(6) )
>CREATE CURSOR t2 ( rida c(10), month c(6) )
>
>I need to delete from table t1 so that only last month rows remain.
>
>I tried
>
>
DELETE FROM t1 ;
>  WHERE ( left(rida,2),month ) NOT IN ;
>   (SELECT left(rida,2), MAX(month) FROM  t2 ;
>   group by 1)
>
>
>but got error
>
>Function name is missing )
>
>
>How to run this statement in VFP ?

You can't do that, try:
DELETE T1;
FROM t1 ;
INNER JOIN (SELECT left(rida,2) AS Rida2,;
       MAX(month) AS Mnt FROM  t2 ;
       group by 1) Tbl1;
ON left(t1.rida,2) = Tbl1.Rida2 AND;
   t1.Month        = Tbl1.Mnt
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform