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:
01210103
Views:
15
Hello Cecil, try something like this:
select cu.Cust, cu.Name, 
sum(si.Qty), sum(isnull(so.Qty,0)), sum(isnull(so.Qty,0) - si.Qty) 
from Customers as cu
left join StandsIn  as si on cu.Cust = si.Cust
left join StandsOut as so on cu.Cust = so.Cust
group by cu.Cust, cu.Name
order by cu.Name
c.x.
>
>NAME OF CUSTOMER QTY Recv'd QTY Sent Out Difference (Recv'd-Shipped)
>CUSTOMER_A 13 23 -10
>CUSTOMER_B 98 58 40
>CUSTOMER_C 112 140 -28
>CUSTOMER_D 1000 980 20
>
>What we are trying to do is to focus on the customers who have not been returning our stands, so that if we see a negative number, we know that that customer has not been returning our WIRE STANDS and can then focus on them.
>
>I tried a regular UNION SQL Statement, but that didn't seem right. Would this require more of a LEFT OUTER JOIN type of statement?
Previous
Reply
Map
View

Click here to load this message in the networking platform