Deleting a row based on the max value

Robert de Klerk picture Robert de Klerk · Sep 1, 2010 · Viewed 30.8k times · Source

How can I structure a mySQL query to delete a row based on the max value.

I tried

WHERE jobPositonId = max(jobPostionId)

but got an error?

Answer

Konerak picture Konerak · Sep 1, 2010
DELETE FROM table ORDER BY jobPositonId DESC LIMIT 1