不能在ON子句中使用比较运算符吗?
[如何复制]
表1
CREATE TABLE table1
(
str1 String,
num1 UInt64
) ENGINE=MergeTree()
ORDER BY (str1);
table2
CREATE TABLE table2
(
str2 String,
num2 UInt64
) ENGINE=MergeTree()
ORDER BY (str2);
查询
SELECT
*
FROM
table1 AS t1
LEFT OUTER JOIN
table2 AS t2
ON
t1.str1 = t2.str2
AND greater(t1.num1, t2.num2) = 1;
错误消息
DB::Exception: Invalid columns in JOIN ON section. Columns num1 and num2 are from different tables..
没有AND greater(t1.num1, t2.num2) = 1
,查询成功。