GROUP BY a date, with ordering by date.

Posted by standard on Stack Overflow See other posts from Stack Overflow or by standard
Published on 2010-05-14T10:58:59Z Indexed on 2010/05/14 11:04 UTC
Read the original article Hit count: 207

Filed under:
|
|

Take this simple query:

SELECT DATE_FORMAT(someDate, '%y-%m-%d') as formattedDay
FROM someTable
GROUP BY formatterDay

This will select rows from a table with only 1 row per date.
How do I ensure that the row selected per date is the earliest for that date, without doing an ordered subquery in the FROM?

Cheers

© Stack Overflow or respective owner

Related posts about mysql

Related posts about group-by