I'm not even sure this is possible... I'll show you what I'm working with, then what I would like to do:
state:
state_id
town:
town_id
state_id
misc_property
street:
street_id
town_id
state_id
These are set up in a hierarchy.
What I want to select:
I would like to select all towns with a misc_property, while at the same time selected the state it belongs to and counting all of the streets in that town.
This is what I have so far:
$sql="SELECT
a.state_id AS state_id,
b.town_id AS town_id,
COUNT(c.street_id)
FROM
state a,
town b,
street c
WHERE
b.misc_property='$property'";