mysql - Getting an item count and joining table to display items customer detail -


i have 2 tables: customers items

i need display query shows each customers (selling) items total

example:

customer_name | total_items_customer_selling | customer_address

i have used count() keep getting total value items in table

select count(id) items group items.id 

also how join ? hope that's specific enough

structure:

customers(id(primary), name, address, city, state).

items(id(primary), description, cost, seller(fk))

hope explains structure better

select c.id,  c.name, count(*) items customers c left join items on i.seller = c.id group c.id, c.name 

Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -