I very much need some help with a postgres query.
I have 3 tables:
domains(
domain_id,
domain_name
)
stores(
store_id,
store_name,
domain_id
)
customer_prospects(
customer_id,
store_id,
salesperson_id
)
I need a query that will will give me the number of customer_prospects in each domain like"
"Select domain_name,count(customer_id) from ..."
How to write this really has me stumped. I can use multiple queries and foreach loops, but if it can be done in a query I would rather do it that way.
Please help!!




Bookmarks