How can I retrieve programmtically the name of the columns implied into a certain SQL, for instance:

Code:
SELECT * FROM table1, table 2 WHERE table1.id = table2.id;