Solved

Please help with a Query

Posted on 2014-04-22
4
194 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
ID: 40016078
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
ID: 40016079
Try this:
select groupid, count(inventoryid) as 'TotalInventoryIDs' from tablename groupby groupid
0
 
LVL 33

Assisted Solution

by:Norie
Norie earned 100 total points
ID: 40016082
Try this.

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

Author Closing Comment

by:Basicfarmer
ID: 40016089
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Close Print Preview button not active 12 36
Library not Registered 16 49
Access Query based on a Form Field 2 20
tabctrl with page click event 9 10
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

920 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

18 Experts available now in Live!

Get 1:1 Help Now