Enumerating tables used in mysql query?
Is there any way to enumerate tables used in mysql query? Lets say I have query : SELECT * FROM db_people.people_facts pf INNER JOIN db_system.connections sm ON sm.source_id = pf.object_id INNER JOIN db_people.people p ON sm.target_id = p.object_id ORDER BY pf.object_id DESC And I want in return array: $tables = array( [0] => 'db_people.people_facts', [1] => 'db_system.connections', [2] => 'db_people.people', ); Wiliam The solution marked as good will return only the result tables. But if you do the next query it will fail: SELECT users.* FROM users, cats, dogs WHERE users.id = cats.user_id