tags:

views:

240

answers:

2

The thing is that it does return one row.

Here's the thing.

SELECT...

FROM...

WHERE...

GROUP BY...

HAVING randomNumber > (SELECT value FROM.....)

Whenever I have signs such as =, > it always returns me this error. When I do IN it doesn't.

Are you not supposed to use comparison signs when comparing to another table?

+3  A: 

When you type:

SomeValue IN (SELECT ...)

it is equivalent to using:

SomeValue = ANY (SELECT ...)

Don't use the second notation - but it illustrates a point. When the SELECT returns more than one value, you must use ANY or ALL with the comparator. When you omit ANY or ALL, then you must have a SELECT that returns exactly one value.

Jonathan Leffler
A: 

You can specify multiple values with IN operator. If you are using >, = , < etc. try using this:

HAVING randomNUmber > (SELECT MAX(value) FROM ......)
TheVillageIdiot