Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MAX and MIN

Status
Not open for further replies.

JoSno

Programmer
Apr 11, 2003
45
GB
Hello everyone,

Simple question (I think) that I can't find a definitive answer for. Basically I'm trying to compare some max and min values against explicit values, ie.

SELET ....., max(working_time), min(working_time)
FROM tableA
WHERE ....
AND MAX(working_time) < &quot;1200&quot;
GROUP BY tableA.key;

It reports &quot;ERROR 1111: Invalid use of group function&quot;.

Now I the comparison aorks if I just take an explicit row and compare WHERE working_time < &quot;1200&quot; so it's not a invalid comparison of integer against string or anything like that.

I'm running Linux MySQL version 3.23.53a

Cheers
Jo
 
Code:
SELET ....., max(working_time), min(working_time)
FROM tableA
WHERE ....
GROUP BY tableA.key
having MAX(working_time) < '1200'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top