在存储过程中创建 Select 子句?
我有两个表,其中包含来自两个不同系统的数据。我需要协调这两个表中的数据 列映射需要可配置。
例如:
Table A Table B
Col1A, Col2A Col1B, Col2B
MappingTable
Col1A = Col1B
Col2A= Col2B
所以我需要根据表中的映射有两个这样的结果集。这需要动态决定。即从 A 中选择 _____
。 _____ 需要动态填充。
Select Col1A, Col2A from A
Select Col2B, Col1B from B
这在 MySQL 中可能吗? ?
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
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果列集相似(如果它们不相似),请使用 UNION 子句无论如何,你将无法以有意义的方式组合他们的结果)。
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).