Skip to content
Advertisement

Combine two table with different column name using Union all

I have two tables T1 and T2 with column name proj in T1 and projectID in T2. I have to combine these two tables using Union all. As both column has similar kind of information. How it can done so that it is visible under one column name

Advertisement

Answer

if the datatype are same ,the column names for a UNION result set are taken from the column names of the first SELECT statement.

SELECT proj as project FROM T1 UNION ALL SELECT projectID FROM T2

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement