Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL error
Message
From
23/04/2015 08:53:19
 
 
To
21/04/2015 12:22:05
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01618877
Message ID:
01619008
Views:
66
Hi Tuvia,

your issue may be related to the order in which clauses get executed

http://www.bennadel.com/blog/70-sql-query-order-of-operations.htm

no solution to offer, just a possible path


>It's one of those morning after an all-nighter (which I am getting too old for) and I would appreciate it if somebody would point out my error, probably obvious:
>
>Works:
>
>
>       * REPLACED ACTUAL TABLE NAMES FOR THIS EXAMPLE:
>	SELECT a.ccompany, a.custcode, COUNT(b.req_date) as nTotal,  ;
>					SUM(b.nstorage) as nStorage, SUM(b.tow_chrg) as nTows ;
>				FROM a;
>				JOIN b ON b.custcode = a.custcode;
>				WHERE b.control_no in ;
>					(SELECT towfky FROM redeem WHERE redeem.dredeemdat>= {01/01/2014} AND redeem.dredeemdat<= {12/31/2014}) ;
>				GROUP BY 1,2 ;
>				into cursor temp1 readwrite 
>
>
>Now add the ORDER and the totals go haywire
>
>
>       * REPLACED ACTUAL TABLE NAMES FOR THIS EXAMPLE:
>	SELECT a.ccompany, a.custcode, COUNT(b.req_date) as nTotal,  ;
>					SUM(b.nstorage) as nStorage, SUM(b.tow_chrg) as nTows ;
>				FROM a;
>				JOIN b ON b.custcode = a.custcode;
>				WHERE b.control_no in ;
>					(SELECT towfky FROM redeem WHERE redeem.dredeemdat>= {01/01/2014} AND redeem.dredeemdat<= {12/31/2014}) ;
>				GROUP BY 1,2 ;
>                                ORDER BY 1,2 ;
>				into cursor temp1 readwrite 
>
>
>TIA
Thierry Nivelet
FoxinCloud
Give your VFP application a second life, web-based, in YOUR cloud
http://foxincloud.com/
Never explain, never complain (Queen Elizabeth II)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform