I have table consisting of these fields:
id | date_from | date_to | price
--------------------------------------------
CK1 22-12-2012 29-12-2012 800
CK1 22-12-2012 29-12-2012 1200
CK2 22-12-2012 29-12-2012 1400
CK2 22-12-2012 29-12-2012 1800
CK2 22-12-2012 29-12-2012 2200
How do I create SQL select that groups results by ID, DATE_FROM, DATE_TO and picks lowest value from price.
So result would be
CK1 22-12-2012 29-12-2012 800
CK2 22-12-2012 29-12-2012 1400
1 Answer