[
{
reg_num: 1,
date_creation: 1
},
{
reg_num: 1
date_creation: 2
},
{
reg_num: 2
date_creation: 1
},
{
reg_num: 2
date_creation: 2
},
]
[
{
reg_num: 1
date_creation: 2
},
{
reg_num: 2
date_creation: 2
},
]
SELECT reg_num, MAX( date_creation ) FROM YourTable GROUP BY reg_num
id этого объекта получить?
SELECT id, YourTable.reg_num, YourTable.date_creation
FROM YourTable INNER JOIN
( SELECT reg_num, MAX( date_creation ) AS MaxDate FROM YourTable GROUP BY reg_num ) AS M
ON M.reg_num = YourTable.reg_num AND M.MaxDate = YourTable.date_creation