sql - Which customer has bought 4 or more items in our store? -


Which customer has bought 4 or more items in our store?

  select cutomer.cusName, COUNT (item name) as 'number of items' included on the customer's shop from customer INNER. Cusid = store.cusID by group cutomer.cusName;   

I'm not sure which product has purchased 4 or more items.

To get those customers, add HAVING clause

  SELECT cutomer.cusName, COUNT itemName (AS) 'item number' by customer.cusID = store.cusID group at customer INNER join store cutomer.cusName hosting number (itemName)> gt; 4 = /    

Comments

Popular posts from this blog

mysql - where clause in inner join query -

java - Why my included JSP file won't get processed correctly? -

php - MySQL Query for Advanced Search multiple criteria -