I have below mentioned table:
ID Date Value
AL-1 2017-04-01 22:04:08 154
AL-1 2017-04-05 15:08:45 158
AL-1 2017-04-06 18:09:15 225
AL-1 2017-04-08 20:08:17 254
AL-2 2017-04-01 22:04:08 154
I am trying this: select ID, Value from table1 where id in ('AL-1','AL-2') and group by max(date(Date));
but it gives me output like:
ID Date Value
AL-1 2017-04-01 22:04:08 154
AL-2 2017-04-01 22:04:08 154
Desired Output:
ID Date Value
AL-1 2017-04-08 20:08:17 254
AL-2 2017-04-01 22:04:08 154