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
इससे न्यूनतम और अधिकतम value
मिलेगा पिछले 7 दिनों में प्रत्येक दिन के लिए।
संपादित करें: संपूर्ण पंक्ति का डेटा प्राप्त करने के लिए अद्यतन समाधान:
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