Subject How to retrieve columns with the same name
Author Carsten Schäfer
Hi,
i do a 'double' join on a table.
String select ="select * from t_apos LEFT join t_ergebnisdaten t1 on
t_apos.f_id_ergebnisdaten_soll = t_ergebnisdaten.id_ergebnisdaten LEFT
join t_ergebnisdaten t2 on t_apos.f_id_ergebnisdaten_ist =
t_ergebnisdaten.id_ergebnisdaten where id_apos = 100";

I tried
ResultSet rs = stmtSelect.executeQuery(select);
while (rs.next()) {
String b1 = rs.getString("t1.f_kh");
System.err.println("KH1:"+b1);
String b2 = rs.getString("t2.f_kh");
System.err.println("KH2:"+b2);
}
rs.close();

but i got an SQLException org.firebirdsql.jdbc.FBSQLException: Column
name t1.f_kh not found in result set.
In IBExpert this is working, but why not in Java ?

With String b1 = rs.getString("f_kh"); i only can get the columns from
the first join, but not from the second.
I know i can use rs.getString(15), but that is dangerous because the
count of columns is often changed in our tables.
I know i can use aliases instead of "select * from", but this would be
much work, because there are more than 100 colums per table.
Is there an easier way ?
(Using FB 1.5.3/Jaybird 2.0.1/WinXPSP2)

mfg
Carsten