Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL syntax problem
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00342976
Message ID:
00343428
Views:
22
>>
>>>SELECT lkacode.account, description, lkacode.aie_code, ;
>>>       &budget as budget, sum(achecks.amount) ;
>>>       FROM N:\artfox2\data\artfox2!lkacode, achecks ;
>>>       WHERE lkacode.account = achecks.account ;
>>>       AND achecks.entryid between (nLow) and (nHigh) ;
>>>       AND lkacode.aie_code = achecks.itemcode ;
>>>UNION ;
>>>SELECT lkacode.account, description, lkacode.aie_code,;
>>>       &budget as budget, 0.0 ;
>>>       FROM N:\artfox2\data\artfox2!lkacode ;
>>>       WHERE lkacode.account+lkacode.aie_code NOT IN ;
>>>       (SELECT achecks.account+achecks.itemcode;
>>>       FROM n:\artfox2data\artfox2!lkacode, achecks ;
>>>       WHERE lkacode.account = achecks.account ;
>>>       AND achecks.entryid between (nLow) and (nHigh) ;
>>>       AND lkacode.aie_code = achecks.itemcode) ;
>>>       INTO table f:\artfox\led_summ ;
>>>       ORDER BY 1, 3 ;
>>>       group by achecks.itemcode ;
>
>Mark,
>
>Thanks for you help! I have everything working except when I add the group by
>achecks.itemcode I receive a Syntax error while the code is running. I do not understand why the code works in VFP 3.0b and not in VFP 6.0 SP3. Any Ideal ?

Ooops! When you use a UNION, your ORDER BY and GROUP BY have to reference the fields by their relative number in the select list. Plus, I do not see that field in the select list.
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform