JDBC, SQL-SELECT: Aliases for multiple columns?
using SQL, JDBC with MaxDB 7.6, I am used to doing something like
SELECT A AS FOO_A, B AS FOO_B, C AS BAR_C FROM FOO, BAR WHERE ...
in order to make table columns have names sometimes more "meaningful" than in the actual database scheme. In a give environment, I will have to do a
SELECT * FROM FOO,BAR WHERE ...
with the difficulty that FOO and BAR contain columns of the same name, yet they both contain too many columns to actually enumerate/alias each one of them manually. Playing around trying something like
SELECT FOO.* AS FOO_*, BAR.* AS BAR_* FROM FOO,BAR WHERE ...
of course didn't work, and browsing the web I found there is no "standard SQL" way of doing something like this. Using
method which allows for determining the "table name" for a given column in the fetched result set, but unfortunately, the outcome returned by this method always seems to be empty. So to ask:
- Is there any way in MaxDB-SQL to allow for "aliasing multiple columns"?
- Alternatively, is there a way to make an SQL query joining multiple tables in MaxDB issued through JDBC generally return table columns in a <tablename>.<columnname> rather than just <columnname> style?
Thanks a bunch in advance, best regards.