Solved

Please help with a Query

Posted on 2014-04-22
4
193 Views
Last Modified: 2014-04-22
Experts please help me. I have a table with two fields that I need to work with.
1. GroupID
2. InventoryID

The table might look something like this

GroupID     InventoryID
1                  43
1                  22
1                  23
1                  67
1                  55
3                  21
3                  13

I need a query to return the number of inventoryID's for each type of group in the table.
0
Comment
Question by:Basicfarmer
4 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 300 total points
Comment Utility
Try this SQL:

SELECT TableA.GroupID, Count(TableA.InventoryID) AS CntInvID
FROM TableA
GROUP BY TableA.GroupID;

Change TableA to your table name.

mx
0
 
LVL 18

Assisted Solution

by:Raheman M. Abdul
Raheman M. Abdul earned 100 total points
Comment Utility
Try this:
select groupid, count(inventoryid) as 'TotalInventoryIDs' from tablename groupby groupid
0
 
LVL 33

Assisted Solution

by:Norie
Norie earned 100 total points
Comment Utility
Try this.

SELECT GroupID, Count(GroupID)
FROM [YourTable]
GROUP BY GroupID
0
 

Author Closing Comment

by:Basicfarmer
Comment Utility
Thanks for the quick replies. You all had the same thing thing so a gave more points to DatabaseMX since he was first.

Thanks again...
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to implement Singleton Design Pattern in Java.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now