How to access a column by name from ResultSet of an INNER JOIN - duplicate column names?

39 Views Asked by At

Using JDBC and SQLite, the ResultSet obtained from a SELECT with an INNER JOIN may contain duplicate column-names, e.g.

SELECT A.id, B.id FROM A
INNER JOIN B ON (A.id=B.ref)

How can I get the A.id and B.id?

p.s. I can see that ResultSetMetaData meta = rs.getMetaData() does contain the table name for each column, referenced by column number. But I can't see how to tell rs.getString(...) to give me A.id etc.

0

There are 0 best solutions below