SELECT DATE(FROM_UNIXTIME(time)) AS daygroup,
MAX(value) AS max_value,
MIN(value) AS min_value
FROM tbl
WHERE time >= UNIX_TIMESTAMP(CURDATE() - INTERVAL 7 DAY)
GROUP BY daygroup
Dit krijgt het minimum en maximum van value
voor elke dag in de afgelopen 7 dagen.
Bewerken: Bijgewerkte oplossing om de gegevens van de hele rij te krijgen:
SELECT a.*
FROM tbl a
INNER JOIN
(
SELECT DATE(FROM_UNIXTIME(time)) AS daygroup,
MAX(value) AS max_value
FROM tbl
WHERE time >= UNIX_TIMESTAMP(CURDATE() - INTERVAL 7 DAY)
GROUP BY daygroup
) b ON DATE(FROM_UNIXTIME(a.time)) = b.daygroup AND a.value = b.max_value