user14263992
user14263992

Reputation: 115

average purchase

enter image description here

how to get customer ids whose average purchase is more than 50 rupees (col.3 is purchase id and has to be aggregated per customer)

SELECT distinct customer id from table where average purchase of a customer is greater than 50 group by customer id

Upvotes: 0

Views: 36

Answers (1)

Fahmi
Fahmi

Reputation: 37473

You can try the below -

SELECT customer_id 
from table 
group by customer_id
having avg(col2)>50

Upvotes: 2

Related Questions