Because subqueries that are introduced by unmodified comparison operators must return a single value, they cannot include group by and having clauses unless you know that the group by and having clauses will return a single value.
For example, this query finds the books that are priced higher than the lowest priced book in the trad_cook category:
select title from titles where price > (select min(price) from titles group by type having type = "trad_cook")
Copyright © 2005. Sybase Inc. All rights reserved. |