I have a database table which link locations together; a location can be in a location, which can be inside another location.
location (<id>, ....)
location_parent (<location_id>, <parent_id>)
Here's the MySQL/PHP to go down for a depth of one:
$sql = "SELECT id FROM se_locations_services WHERE parent_locationid IN
( SELECT location_id FROM se_locations_parent WHERE parent_id = '$locationid' )";
How do I, given a parent location, gets all its descendants locations, no matter how deep, just using MySQL?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…