Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Received / Outgoing Product
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01210081
Message ID:
01210353
Views:
14
>Hi Sergey,
>
>I am not very good at these SQL statements as can be seen below:
>
>
>SELECT ;
>    Cust, Customer, QtyIn, QtyOut, QtyIn-QtyOut As QtyDiff ;
>      FROM ( ;
>         SELECT ;
>            CustNo As Cust, ;
>            Customer, ;
>            SUM(si.StandsIn) AS QtyIn, ;
>            SUM(so.SerialCnt) As QtyOut ;
>               FROM Customer cs ;
>                  LEFT JOIN StandsIn si ON si.cust = cs.cust ;
>                  LEFT JOIN Stands_Out so ON so.cust = cs.cust ;
>               GROUP BY ;
>                  Cust, ;
>                  Customer ;
>       ) dt1;
>*WHERE QtyOut > QtyIn ;
>
>"CustNo" is the name of the Customer ID in the Customer table; elsewhere it is "Cust".
>
>I get the following error: "SQL: Column 'Cust' is not found."

Change this to GROUP BY 1,2 instead.

But I don't think this SQL will give you the desired output according to the thread I pointed you to.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform