This is my Table :
DROP TABLE IF EXISTS MYTABLE
Create table MyTable (
Id int not null ,
Date_Action datetime2 not null,
Firt_Date date not null ,
Last_date date not null ,
STH_ID int not null,
Day_NUMBER int not null )
This is my values
INSERT INTO MyTable
valueS ( 2345, '2022-09-13 06:43:02.9866667', '01-01-2021', '31-12-2021', 443, 1),
(2769, '2022-09-14 12:59:03.8033333', '01-01-2021', '31-12-2021', 443, 1),
(2343, '2022-09-13 06:43:02.9866667' , '01-01-2021' , '31-12-2021' , 443 ,2),
(2771, '2022-09-14 12:59:03.8066667' , '01-01-2021' , '31-12-2021', 523, 2)
I want to show only rows that have max(Date_action) per day. Only two rows rather than 4. How Can i do it to remove duplicates please ?