Solved

How to use 'Count' in Access for a field of type string

Posted on 2014-12-02
1
177 Views
Last Modified: 2014-12-02
Dear All,

I have a table with the following fields.  I'm trying to count the number of times the same string appears in ItemID, the same string in ModelID for each LocationID.

ID (Number)
ItemID (String)
LocationID (Number)
ModelID (String)

I've tried:

SELECT Count([Table1].ItemID) AS ItemCount, Count([Table1].ModelID) AS ModelCount, [Table1].LocationID
FROM 
(SELECT DISTINCT [Table1].LocationID FROM  [Table1] );

Open in new window




The error states Query does not include LocationID as part of Aggregate function.  

Thanks
0
Comment
Question by:AndyC1000
1 Comment
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 40477813
try

SELECT Count([Table1].ItemID) AS ItemCount, Count([Table1].ModelID) AS ModelCount, [Table1].LocationID
FROM  [Table1]
Group By  [Table1].LocationID
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

860 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