Hi,
I have a customer table with related tables (invoice, products etc). All these related tables have customer_id column as Foreign key. I need a query which will give me counts of invoices, products etc corresponding to each customer id for example like this
cust_id count(inv) count(prod)
100 10 40
101 2 10
102 22 25
I tried to join these tables and group by customer_id, but I am not getting the correct answer. How could I do this?
dbadmin
I have a customer table with related tables (invoice, products etc). All these related tables have customer_id column as Foreign key. I need a query which will give me counts of invoices, products etc corresponding to each customer id for example like this
cust_id count(inv) count(prod)
100 10 40
101 2 10
102 22 25
I tried to join these tables and group by customer_id, but I am not getting the correct answer. How could I do this?
dbadmin