Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update Sql Command
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01202518
Message ID:
01203603
Views:
18
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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform