mysql update where some field is max
- by Syom
The table videos has the following fields:
id | average | name
How can i write the query, to update the name of video, which have the max average, or the second by size average!!! i can do that with two queries, by selecting the max(average) from the table, and then update the name, where ite average equal to max or to second value, but i want to do that in one query.
i think the query must look like this
UPDATE videos SET name = 'something' WHERE average = MAX(average)
Any suggestions?