IN

SinceVersion 1.2.0

IN

description

Syntax

expr IN (value, ...)

expr IN (subquery)

If expr is equal to any value in the IN list, return true; otherwise, return false.

Subquery can only return one column, and the column types returned by subquery must be compatible with expr types.

If subquery returns a bitmap data type column, expr must be an integer.

notice

  • Currently, bitmap columns are only returned to in subqueries supported in the vectorized engine.

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