MAX function in where clause mysql [duplicate]
We can’t reference the result of an aggregate function (for example MAX() ) in a WHERE clause of the same SELECT. The normative pattern for solving this type of problem is to use an inline view, something like this: SELECT t.firstName , t.Lastname , t.id FROM mytable t JOIN ( SELECT MAX(mx.id) AS max_id FROM … Read more