Querie count??

brin

Registered User.
Local time
Today, 11:31
Joined
Nov 14, 2001
Messages
41
I am trying to do the following but the counts i am getting are bizzare???
SELECT [Error Log].[Welcome Pack Status], [Staff List].Region, Count([Staff List].Region) AS CountOfRegion
FROM [Staff List], [Error Log]
GROUP BY [Error Log].[Welcome Pack Status], [Staff List].Region;

I only have the two tables, i am trying to do the count using fields from both of them i think this has something to do with it???
 
You'll need to join the tables in your query.
Say ID is your Primary Key field for [Staff List] and the Foreign Key for your table [Error Log], your statement would be:

SELECT [Error Log].[Welcome Pack Status], [Staff List].Region, Count([Staff List].Region) AS CountOfRegion
FROM [Staff List] INNER JOIN [Error Log] ON
[Staff List].ID=[Error Log].ID
GROUP BY [Error Log].[Welcome Pack Status], [Staff List].Region;

Now you're getting a so-called carthesian products (all possible combinations between your two tables).

Suc6,

RV
 
Thanks. But this doesn't seem to work??? Any other ideas??
 

Users who are viewing this thread

Back
Top Bottom