Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,I have 3 tables with the same table structure.Which is the best way to combine these 3 tables?
Concatenate/join/ not mentioning either?
Please suggest. Thanks in advance.
Table1:
Select C1,C2,C3 from Table1
Table2:
Select C1,C2,C3 from Table2
Table3:
Select C1,C2,C3 from Table3
Hi,
You can concatenate the 3 tables, since all having the same columns so Concatenate is the best option. If you want a flag to identify the source of each you can add the flag like below
Data:
Select C1,C2,C3, 'Table1' AS Source from Table1.
Concatenate(Data)
Select C1,C2,C3, 'Table2' AS Source from Table2.
Concatenate(Data)
Select C1,C2,C3, 'Table3' AS Source from Table3.
Hope this helps you.
Regards,
Jagan.
I would think Concatenating them would make sense.
Hi,
You can concatenate the 3 tables, since all having the same columns so Concatenate is the best option. If you want a flag to identify the source of each you can add the flag like below
Data:
Select C1,C2,C3, 'Table1' AS Source from Table1.
Concatenate(Data)
Select C1,C2,C3, 'Table2' AS Source from Table2.
Concatenate(Data)
Select C1,C2,C3, 'Table3' AS Source from Table3.
Hope this helps you.
Regards,
Jagan.
What data is there in columns C1, C2 & C3 if anyone is a measure like Sales then Concatenate it without further thinking.
If you join ultimately you will get only 3 columns by reducing the Row Count.
Regards,
Jagan.
Thank you both of you.
concatenate is best option ...
Check below links, hope it helps you.
Merging Data from Multiple Sources
Understanding Join, Keep and Concatenate
Regards,
jagan.
Thank you so much Jagan.