I have a database table which link locations together; a location can be in a location, which can be inside another location.
location (, ....)
loc
Since mysql statements can return only table-structured data, how do you imagine the returned tree-structure?
It is possible to do a selection with [parent_id, child_id] table, but it requires temporary table and I've seen it done on DB2, not on MySQL.
Check this article for implementation on tree-like structures stored in MySQL: http://articles.sitepoint.com/article/hierarchical-data-database/