Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Group By does not return right result with multiple tabl
Message
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 8 SP1
Database:
Visual FoxPro
Divers
Thread ID:
01186807
Message ID:
01187063
Vues:
30
>>>>Or:
>>>>
>>>>SELECT Fld1, SUM(Ammount) AS Ammount1;
>>>>       FROM crsTest1;
>>>>GROUP BY Fld1;
>>>>INTO CURSOR cTest1
>>>>
>>>>SELECT Fld1, SUM(Ammount) AS Ammount2;
>>>>       FROM crsTest2;
>>>>GROUP BY Fld1;
>>>>INTO CURSOR cTest2
>>>>
>>>>SELECT crsTest.Fld1,;
>>>>       cTest1.Ammount1,;
>>>>       cTest2.Ammount2;
>>>>FROM crsTest;
>>>>INNER JOIN cTest1 ON crsTest.Fld1 = cTest1.Fld1;
>>>>INNER JOIN cTest2 ON crsTest.Fld1 = cTest2.Fld1
>>>>
>>>
>>>You would use LEFT JOIN and it's even more steps <g>
>>
>>Why? The steps are the same, just you must use
>>NVL(cTest1.Ammount1, 000000.00) AS Amount1,;
>
>I meant you're using 3 selects, which is greater than 2. <g>

Yes, but no UNIONs :-)
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
Répondre
Fil
Voir

Click here to load this message in the networking platform