IN

SinceVersion 1.2.0

IN

description

Syntax

expr IN (value, ...)

expr IN (subquery)

如果 expr 等于 IN 列表中的任何值则返回true,否则返回false。

subquery 只能返回一列,并且子查询返回的列类型必须 expr 类型兼容。

如果 subquery 返回bitmap数据类型列,expr必须是整型。

notice

  • 当前仅向量化引擎中支持 in 子查询返回bitmap列。

example

  1. mysql> select id from cost where id in (1, 2);
  2. +------+
  3. | id |
  4. +------+
  5. | 2 |
  6. | 1 |
  7. +------+
  1. mysql> select id from tbl1 where id in (select id from tbl2);
  2. +------+
  3. | id |
  4. +------+
  5. | 1 |
  6. | 4 |
  7. | 5 |
  8. +------+
  1. mysql> select id from tbl1 where id in (select bitmap_col from tbl3);
  2. +------+
  3. | id |
  4. +------+
  5. | 1 |
  6. | 3 |
  7. +------+

keywords

  1. IN