sql - MySQL filtering out a criteria -


i thought simple guys here, little bit hard me figure out how this. have tried did not result wanted consult every 1 here.

here have 3 columns: state, store, laptop_brand wanted filter out how many store have amount of hp < 3 ( group state).

my idea on this:

select state, count(laptop_brand) sample_survey count(select store sample_survey laptop_brand = "hp") <3 group state

but not make real. sample_survey attached pic snippet data reference.

thank suggestions.

please try this:

select state, store, count(laptop_brand) total_laptop  sample_survey  laptop_brand = "hp"  group state, store  having count(laptop_brand)<3 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -