JDBC ResultSet get columns with table alias

后端 未结 7 973
春和景丽
春和景丽 2020-11-28 13:22

Imagine I have a query like

SELECT * from table1 a, table2 b where (WHATEVER)

Maybe both tables have the same column name. So I though it

7条回答
  •  天涯浪人
    2020-11-28 13:44

    Use column aliases like:

    SELECT A.ID 'A_ID', B.ID 'B_ID' FROM TABLE1 AS A, TABLE2 AS B...
    

    And specify all the columns you are retrieving (is a good practice).

提交回复
热议问题