count within a given range

L

Laurel

I have a table of Customers that are assigned a Market ID and a second table
that groups the Market IDs by a range and assigns them to an Industry
description.

For example:
Cust Table
Customer Name, Market ID

Market Table
Market IDs 1000 thru 1199, Industry1
Market IDs 1200 thru 1399, Industry2

I want a query to count the number of customers that fall in the range on
the Market Table.
Industry1 has X customers. Industry2 has X customers.
 
J

John W. Vinson

I have a table of Customers that are assigned a Market ID and a second table
that groups the Market IDs by a range and assigns them to an Industry
description.

For example:
Cust Table
Customer Name, Market ID

Market Table
Market IDs 1000 thru 1199, Industry1
Market IDs 1200 thru 1399, Industry2

I want a query to count the number of customers that fall in the range on
the Market Table.
Industry1 has X customers. Industry2 has X customers.

A "Non Equi Join" is one solution here. Set up your market table with three
fields, Low, High, and Industry; use a query

SELECT [Cust Table]. <whatever you want to see>, [Market Table].[Industry]
FROM [Cust Table] INNER JOIN [Market Table]
ON [Cust Table].[Market ID] >= [Market Table].[Low]
AND [Cust Table].[Market ID] <= [Market Table].[High];
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top