Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Correct addition from 2 tables
Message
 
 
À
16/06/2014 17:32:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 5
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01601931
Message ID:
01601932
Vues:
58
>Hi All:
>
>Please consider the following:
>
>
>Table1:
>
>Custno     Sales
>ABCD      40000
>XYZS      20000
>
>Table2:
>
>Custno     Sales
>XYZS      100
>YYYY      7000
>
>
>I want to come up with SQL that will generate a cursor called cursor1 with total sales for each customer:
>
>
>Cursor1:
>
>Custno     TotalSales
>ABCD      40000
>XYZS      20100
>YYYY      7000
>
>
>Note that custno ABCD is absent from table2, XYZS is present in both and YYYY is absent from table1. Also, please note that this is for VFP 5, so nesting SELECTs may not work.
>
>Thanks,
>
>Yossi

VFP5 ? Does it have FULL JOIN?

E.g.
select NVL(C1.CustNo, C2.CustNo) as CustNo, NVL(C1.Sales,0) + NVL(C2.Sales,0) as TotalSales ;
from cursor1 C1 FULL JOIN cursor2 C2 ON C1.CustNo = C2.CustNo
Can you upgrade to VFP9? VFP5 is so ancient, that it's hard to predict what is there and what is not.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform