【发布时间】:2016-06-22 10:59:30
【问题描述】:
我想根据列的优先级加入 2 个表
例如。假设 Table1 有六列(Col1,Col2,Col3,Col4,Col5,Col6) 如果我想将表 1 与表 2 (Col1,Col2,Col3,Col4,Col5,Col7) 连接起来,它应该
否则
Select Table2.col7
where
first check col1 , col2 and col3 if match found no need go check more
second check col1 , col2 if match found no need go check more
third check col1 if match found no need go check more
last ignore all col1 , col2 and col3
AND Table1.Col4=Table2.Col4
AND Table1.Col5=Table2.Col5
我的话可能不太清楚,如果有什么问题请大声疾呼
【问题讨论】:
-
使用“或”而不是“与”。如果找到匹配,则不检查其他条件
-
(!!!) UPD:我错了:stackoverflow.com/questions/8900631/…
标签: oracle