I’m trying to select a value which corresponds to the lowest number in another column, and then use it to SET in another table.
But it’s telling me “group function is not allowed here”
is there any other way to accomplish this?
UPDATE team
SET OWNERID = (SELECT USERID
FROM teamuser
WHERE MIN(CREATETIME)
AND teamId = 5)
WHERE teamId = 5
(Both team and teamuser tables have a column teamId).
you should do
You can’t use agreggate functions in where clause, only you can use it on selects, or in Having clause, after group by