I have a table like this
id, price, date
1, 200, 20180923
2, 100, 20180923
3, 300, 20180923
4, 300, 20180924
5, 200, 20180924
6, 100, 20180924
I want to find the minimum price for a given date, and retrieve the ID along with it.
So SELECT id, MIN(price), date FROM table GROUP BY date
will return the lowest price for each date, but it doesn't tell me which id
it belongs to.
The expected output here would be
2, 100, 20180923
6, 100, 20180924