I have two tables coming which has data from two different systems. I need to reconcile the data in these two tables The column mapping needs to be made configurable.
E.g.:
Table A Table B
Col1A, Col2A Col1B, Col2B开发者_如何学Python
MappingTable
Col1A = Col1B
Col2A= Col2B
So I would need to have two result sets like this based on the mappings in the table.This needs to be decided dynamically. i.e. Select _____ from A
. The _____ needs to be filled dynamically.
Select Col1A, Col2A from A
Select Col2B, Col1B from B
Is this possible in MySQL?
Use a UNION clause if the column sets are similar (if they're not you won't be able to combine their results in a meaningful way, anyway).
select col1a, col2a from A
union
select col1b, col2b from b
精彩评论