The
existspredicate specifies a result set of values to match in awhereclause.Syntax
select * from ... where exists (select valX from ... where ...)The
notoperator can be added to an expression usingin:select * from ... where not exists (select valX from ... where ...)Examples
create table dep(id int, name char(20)); create table emp(name char(20), deptId int); insert into dep values([1,2,3],['Sales','Customer Service','Technical Support']); insert into emp values(['Smith','Jones','Black','Clark','Adams'], [3,3,1,2,1]); select name from emp where exists (select * from dep where id = emp.deptId and dep.id = 1); name ------------------------------------------------------------------------------ Black Adams Selected records: 2For more examples please see xSQL SDK sample
exists.