Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL query for item count
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
SQL query for item count
Miscellaneous
Thread ID:
00655656
Message ID:
00655656
Views:
54
I've got two tables, stock and item.


The stock table has a "level" field, for a desired inventory level, for example we always want to keep 10 widgets on hand so the stock record would be something like:

Stock_no Description Level
WID001 Widget, Octagonal 10


Now, in the item table, I have the actual items:

Stock_no Status
WID001 Shelf
WID001 Shelf
WID001 Shelf
...

Can I get a count of the items as well as a the stock number and description in a single SQL statment?

I tried
 SELECT stock.stock_no, equip_name, count(item.*);
   FROM stock, item;
   WHERE item.stock_no=stock.stock_no
but that just returns a syntax error.

Seems I should be grouping or something..
-- Larry Keyes
Remember only You can prevent Gray Goo. Never release nanobot assembers without replication limiting code.
Next
Reply
Map
View

Click here to load this message in the networking platform