select where (something) matches > 4 records

dougmcc1

Registered User.
Local time
Today, 11:11
Joined
Jul 29, 2004
Messages
27
Hi,

Lets say I have a table with 4 fields - product, location, transactions, cost

How do I select all the products (and their location) from the table that exist in the table more than 4 times with transaction=0 and cost>3?

There might be records for the product with more than 0 trans or < $3 cost but I don't want to include those in the query.

Thank you in advance.
 
the query is:

select product, location
from tablename
where transactions = 0 and cost >3
group by product, location
having count(*) > 4


hope this will help u .
 
Thanks krunalprajapati. I got it working before you responded but hopefully someone else will find this of use.
 

Users who are viewing this thread

Back
Top Bottom