Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update Sql Command
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01202518
Message ID:
01203603
Vues:
19
Can you explain what you're trying to do? It doesn't make sense of updating Agenda from Agenda.

>
> CREATE CURSOR Traiter ( iid I , nstock N(8,2) )
>  CREATE CURSOR Agenda ( iid I , ddate D(8) , itraiterId I , nstock N(8,2) )
>
>  INSERT INTO Traiter ( iid , nstock ) VALUES ( 1 , 14.25 )
>  INSERT INTO Traiter ( iid , nstock ) VALUES ( 2 , 4.25 )
>  INSERT INTO Traiter ( iid , nstock ) VALUES ( 3 , 0 )
>
>
>  INSERT INTO Agenda ( iid , ddate  , itraiterId ) VALUES ( 1 , DATE() , 2)
>  INSERT INTO Agenda (iid , ddate  , itraiterId ) VALUES ( 2 , DATE() , 3 )
>  INSERT INTO Agenda (iid , ddate  , itraiterId ) VALUES ( 3 , DATE() , 1 )
>
>
>  vp_date = DATE()
>
>  *-- I want All stock from traiter
>  *-- If no record in Agenda , take stock in traiter else stock in agenda.
>  UPDATE ap ;
>    SET nstock = pd.nstock ;
>    FROM Agenda ap;
>    JOIN (;
>    SELECT  NVL(apd.nstock, T.nstock) AS nstock, apd.iid ;
>    FROM Agenda apd ;
>    JOIN Traiter T ON T.iid = apd.itraiterId ;
>    WHERE apd.ddate < vp_date ;
>    ) pd ON ap.iid = pd.iid
>
>*-- Give me a bad result..
>  SET
>
>
>
>
>
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform