views:

63

answers:

1

Hi,

Previous programmer left me with "beautiful" piece of code and he kind of forgot to apply something to it. There is a query which selects several items from several tables.

6 Items can be chosen. It means 6 tables can be chosen, however there can be more tables - even 20 of them. I need to get that list of tables from processed query.

Indeed, is it possible at all? Is there any command to get a list of tables the query used?

+1  A: 

I'm unsure if I am understanding the question correctly but it may be worth 'explaining' the query and seeing which tables are being used as below.

EXPLAIN SELECT * FROM table1 JOIN table2 USING (id)

djt