Previous IQ versions supported only limited disjunction of subqueries. Sybase IQ 15.0 removes these restrictions and supports arbitrary combination of ANSI-SQL-89 style subqueries in WHERE or HAVING clauses, with two exceptions.
The following are not supported:
Disjunction of subqueries in CASE statements
Disjunction of subqueries in OUTER JOIN conditions.
Example 1 Disjunction of uncorrelated EXISTS and IN subqueries:
SELECT COUNT(*)
FROM supplier
WHERE s_suppkey IN (SELECT MAX(l_suppkey)
FROM lineitem
GROUP BY l_linenumber)
OR EXISTS (SELECT p_brand
FROM part
WHERE p_brand = ‘Brand#43’);
Example 2 Disjunction of correlated EXISTS subqueries:
SELECT COUNT(*)
FROM supplier S
WHERE EXISTS (SELECT l_suppkey
FROM lineitem
WHERE l_suppkey = S.s_suppkey )
OR EXISTS (SELECT p_brand
FROM part
WHERE p.partkey = S.s_suppkey and
p_brand = ‘Brand#43’);
Example 3 Disjunction of correlated/uncorrelated quantified comparison subqueries:
SELECT COUNT(*)
FROM lineitem L
WHERE l_quantity > (SELECT MAX(s_acctbal)
FROM supplier
WHERE L.l_suppkey
= s_suppkey and s_nationkey = 10)
OR l_partkey >= ANY (SELECT MAX(p_partkey)
FROM part
GROUP BY p_mfgr);