I’m trying to construct the correct sql statement (Oracle) to get the count of device_id’s for each customer_id that is greater than a given value. For example, I want to know the customer_id’s that have more than 3 device_ids. A single device_id can only have one customer_id associated to it, while a customer_id may have many device_ids.
Table:
device_id
customer_id
....
Data (device_id, customer_id):
00001, CUST1
00002, CUST1
00003, CUST1
00004, CUST1
00005, CUST2
00006, CUST2
To get the customers with more than 3 devices: