Yes, this is possible under the following circumstances:
- The subqueries are returning one value.
- There is an outside comparison such as
=
or>
The case
statement returns scalar values. A row with one column and one value is "equivalent" to a scalar value. So, the following would be allowed:
where col = (CASE WHEN date > '2014-02-28' THEN (SELECT max(col2) FROM TABLEC WHERE...)
ELSE (SELECT min(col3) FROM TABLE B WHERE...)
END)
But, you probably want to do a conditional in
statement. Eschew the case
:
where date > '2014-02-28' and col in (SELECT max(col2) FROM TABLEC WHERE...) or
date <= '2014-02-28' and col in (SELECT min(col3) FROM TABLE B WHERE...)