Ho una tabella di database che collega le posizioni insieme; una posizione può trovarsi in una posizione, che può trovarsi in un'altra posizione.MySQL - Recupero di una struttura ad albero
location (<id>, ....)
location_parent (<location_id>, <parent_id>)
Ecco il MySQL/PHP a scendere per una profondità di un:
$sql = "SELECT id FROM se_locations_services WHERE parent_locationid IN
(SELECT location_id FROM se_locations_parent WHERE parent_id = '$locationid')";
Come faccio, dato un luogo genitore, ottiene tutte le sue sedi discendenti, non importa quanto in profondità, usando solo MySQL?
Vedere http://stackoverflow.com/questions/587488/handling-hierarchy-data-in-database –