2
Suppose we have this database
codigo, data, valor,seq
(1, '2014-01-01', 10,2),
(1, '2014-01-02', 20,1),
(2, '2014-01-03', 30,1),
(2, '2014-01-05', 40,1),
(2, '2014-01-05', 50,2),
(3, '2014-01-06', 60,1);
I want to get the latest date by each code, however, there will be repeated dates, and when this occurs I will have to get the biggest Seq.
That is, the expected result is
1, '2014-01-02', 20,1
2, '2014-01-05', 50,2
3, '2014-01-06', 60,1
Mysql or Sqlserver?
– Sveen
@Sveen Sqlserver
– Eduardo Ribeiro