The
in
predicate specifies a set of values to match in awhere
clause. The set can be specified with explicit values enclosed in parentheses or aselect
statement.Syntax
select * from ... where val in (val1, .., valN) select * from ... where val in (select valX from ... where ...)The first form of this expression is equivalent to:
select * from ... where val = val1 or val = val2 .. or val = valNThe
not
operator can be added to an expression usingin
:select * from ... where val not in (val1, .., valN)Examples
create table names(s char(20)); insert into names values(['Smith','Jones','Black','Clark','Adams']); select * from s where s in ('Jones','Smith'); s ------------------------------------------------------------------------------ Smith Jones Selected records: 2 select * from names where s not in ('Jones','Smith'); s ------------------------------------------------------------------------------ Black Clark Adams Selected records: 3 select * from s where s in (select s from names where s like 'A%'); s ------------------------------------------------------------------------------ Adams Selected records: 1For more examples please see xSQL SDK sample
in
.