sql, counts, joins

admin

Administrator
Staff member
I have this query
SELECT categories.id as catid, categories.name as catname, segments.id AS sid, segments.name as sname FROM categories , segments WHERE (segments.id = categories.segment AND categories.segment=3;

to so me a list of subcategory names so I can modify them. (segments is a main category, and then categories are below that one level).

I have a 3rd table called ads, that has field category (related to categories.id).

I want to return a list of the category names, within the segment, and a count of how many ads contain that category. I'm totally lost. Could someone point me in the right direction?

Thahnk you
dan
 
Back
Top