Liferay 6.2 custom joins columns with same names are overlapping

51 Views Asked by At

I have created a custom join following this tutorial, two of the tables contain some columns with the same name and in the result set the value of the first table column are overriding the values of second table.

1

There are 1 best solutions below

0
Aziz Umarov On

SQL aliases are used to give a table, or a column in a table, a temporary name.

SELECT 
  table1.comlumn1 AS table1Column1,
  table2.comlumn1 AS table2Column1
FROM 
  tab1 AS table1
  JOIN tab2 AS table2
    ON table1.id =  table2.table1Id