Is it possible to do something like this in MySql:
select *, CONCAT(schema_name,'.','my_table') as database_name from table_a a inner join table_b b on b.id = a.id inner join database_name c on a.id2 = c.id;
Basically, database_name's value is taken from the existing query and also it will be used in the same query.
Is it possible to do something like this without using stored proc? If not, is it possible to do this in Java without using loops?