I would like to know what's the best solution to prevent this error in case of greater than operator :
As mentioned in this question Subquery returned more than 1 value. This is not permitted when the subquery
, the solution in the case of =
is to replace the equals operator to In
and the problem will be fixed. but what about the case when I have >
greater operator.
What can I do in this case?
What can replace the >
operator to solve this issue?
select userId
from Users,table o where
Users.isActive=1 and o.UserId = Users.UserId
group by UserId
having o.HourStart > (select Hour
from Hours h, table b where b.HoursId = Hours.HoursId
group by Hour)