What I need to do is get a table name in result from a union query with 4 selects from different tables. I need to get the id and the table name for further processing.
For example i have table1, table2, table3 table4 and have a query:
SELECT id from table1,blablabla
UNION
SELECT id from table2,blablabla
UNION
SELECT id from table3,blablabla
UNION
SELECT id from table4,blablabla
And I need the result like:
1, blablabla, table1
4, blablabla, table4
7, blablabla, table2