在ON子句中使用比较运算符

时间:2019-06-24 10:50:16

标签: clickhouse

不能在ON子句中使用比较运算符吗?

[如何复制]

  • ClickHouse服务器版本:v19.11.0
  • 带有两个表的示例

表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,查询成功。

0 个答案:

没有答案