To declare a string literal as an output column, leave Table turned off and just use Test . This does not need to be associated with a table between your joins, since only its column alias will be available to it. When using a metadata function such as getColumnMeta() , the table name will be an empty string because it is not associated with the table.
SELECT `field1`, `field2`, 'Test' AS `field3` FROM `Test`;
Note. I use single quotes above. Normally, MySQL is configured to respect double quotes for strings, but single quotes are more widely portable among RDBMSs.
If you must have a table alias name with a literal value, you need to wrap it in a subquery with the same name as the table you want to use:
SELECT field1, field2, field3 FROM (SELECT field1, field2, 'Test' AS field3 FROM Test) AS Test
Now field3 will appear on the output as Test.field3 .
source share