【发布时间】:2020-05-16 21:05:07
【问题描述】:
我的工具在 where 函数中不能接受联合运算符或“或”条件运算符
我有两个问题
第一次查询
Select * from tableA A left outer join tableB B on A.a1=B.b1 where A.a1 =20200131 and B.b2= 'monkey'
第二次查询
Select * from tableA where A.a1 =20200131 and A.a3 ='Tom`
下面使用“或”运算符的组合查询
Select * from tableA A left outer join tableB B on A.a1=B.b1 where B.b2= 'monkey' or A.a3 ='Tom'
但我想要一个不使用“或”运算符和联合的查询
需要可能涉及连接或子查询的简单查询
【问题讨论】:
-
无法在 WHERE 子句中处理 OR 的工具不可用。再买一个。
-
如果您想要真正的 LEFT JOIN 结果,请将猴子条件移至 ON 子句。 (就像现在一样,您会得到常规的 INNER JOIN 结果。)
-
工具生成SQL并在db中运行。但是设计成不能作为过滤条件部分的输入。有什么解决办法吗?
-
不能使用 into 或配合 .it 的一种原始工具
-
“和联合”是什么意思?你知道
select * from t where x or y是select * from t where x union select * from t where y吗?你知道t left join u on x where u.c=... and ...是t inner join u on x where u.c=... and ...吗?您是否意识到t left join u on x是t inner join u on x union all不匹配的 t 行由 null 扩展?x or y也是not (not x and not y)。请更具体地说明您的工具如何转换以及允许使用什么语法,或者您只是让人们在黑暗中猜测。 PSwhere是一个带有“谓词”的“子句”。