E222
E222

Reputation: 21

How to write mysql select to get daily peaks

I have 'table' where i store 'rate' values every 30 minutes ('date' field). I want to get each day maximums (peaks). How can I select with one mysql request? Thanx...

Upvotes: 2

Views: 2456

Answers (2)

Chris Valentine
Chris Valentine

Reputation: 1

If the date field is a Unix timestamp, try:

SELECT time, MAX(data) FROM table GROUP BY DAY(FROM_UNIXTIME(time))

Upvotes: 0

Pelshoff
Pelshoff

Reputation: 1464

SELECT MAX(rate) FROM 'table' GROUP BY DAY(date)

Should work for you :)

Upvotes: 7

Related Questions