jonathana jonathana - 1 year ago 87
SQL Question

SQL: Merge 2 Columns or more from different tables into one Alias new Column

I have 2 tables: DisconnectionsData and DisconnectionsVoice.
those tables are similar, both of them have columns: WeekNum,Month,Quarter,Year,IncomeLost and ID.

the names of the columns are different between the 2 tables, but the data inside them is parallel (Quarter and QuarterNumber is literally the same).

my wish is to

both tables into one table with only 6 columns.
i cant figure out how to make an alias, for example: DisconnectionsData.Quarter and DisconnectionsVoice.QuarterNumber
and merge them into one column with the alias name of QuarterOfDisconnection.

that the desired result:

enter image description here

thank you.

Answer Source

You don't specify which sql are you using? You can try below.

FROM DisconnectionsData
FROM DisconnectionsVoice
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download