1英国 3 60英国
我正在寻找一个提取Result 2日期的方法,添加作为Result 1的列,final作为Expect Result。
在谷歌上搜索后,我尝试使用转换,但结果一团糟。怎么可能我构建结果?谢谢
结果1:
国家您可以使用横向连接——这就像一个可以返回多行的子查询:
select t1.*, t3.*
from table1 t1 outer apply
(select nullif(min(t3.indate), max(t3.indate)) as indate1,
nullif(max(t3.indate), min(t3.indate)) as indate2
from table3 t3
where t3.merchantRef = t1.merchantRef
) t3;