Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Summing by location
Message
From
26/07/1999 12:59:19
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00246115
Message ID:
00246161
Views:
20
Try:
SELECT Inv.Location, Count(OnHand.PK);
   FROM Inv;
   LEFT OUTER JOIN OnHand ON Inv.PK = OnHand.FK;
   GROUP BY Inv.Location
HTH

>I'm not certain as to how to obtain the results I want from a SELECT-SQL statement...
>
>For inventoy there are 2 tables, a master holding all inventory items, and an on-hand, holding only parts that are available in the stockroom or factory. When I select I do an inner join on the part number where the location matches one specified...like 01 for stock, 02 for factory. The onhand table holds only what's in stock, so if there's some in 02, but not 01, then 02 is the only record in the onhand table...that works fine, but for my SQL results I want to show 0 on hand in location 01 when they do a WHERE location=01. What's the best way to do this?
>
>Also, when finding onhand for all locations, I want to show the sum of all locations for that part. Again, what's the best way to proceed?
>
>Should I be using several SELECT statements? Or should I try using a filter? Thanks for any help you might be able to provide, since I'm really quite a greenhorn with SQL;)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform