I'm trying to create a query to return the file with the max version, independent of the value of the server. How could I do that?
actual table data:
server filename v4 date
local code1.zip 41 0000-00-00
remote code1.zip 39 0000-00-00
local code1.zip 28 0000-00-00
remote code1.zip 21 0000-00-00
local code1.zip 32 0000-00-00
remote code1.zip 27 0000-00-00
the query:
SELECT
server,
filename,
max(v4) as v4,
date
FROM
table
WHERE
date ='0000-00-00'
GROUP BY
filename,
server,
date
Actual result:
server filename v4 date
local code1.zip 41 0000-00-00
remote code1.zip 39 0000-00-00
Expected result:
server filename v4 date
local code1.zip 41 0000-00-00
EDIT: It's for MySQL
Thanks in advance.
GROUP BY date
only