Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query question

Status
Not open for further replies.

sabavno

Programmer
Jul 25, 2002
381
CA
hi

I have the table

RecordID Transit AssetType
1 12 1
2 12 1
3 13 1
4 12 2

I need a query to count how many record belongs to what transit

So based on this example I would get

Transit: 12
AssetTYpe:1
Count: 2

Transit:13
AssetTYpe:1
Count:1

Transit:12
AssetType:2
Count:1

Please help me with this query
I got confused

Thanks
 
SELECT Transit, AssetType, COUNT(1)
FROM TA-Table
GROUP BY Transit, AssetType

This is a simple group by query in Access. From the query designer, create a new query, don't select any tables (CANCEL), select View menu, SQL and the copy/paste the above. Change TA-Table to your source table's name.

If you only want total counts by Transit (all AssetType-s), remove AssetType from both SELECT and GROUP BY lines.

kraxmo Spinning gold into straw...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top