Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Group By does not return right result with multiple tabl
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01186807
Message ID:
01187050
Views:
16
>>>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>
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform