select * from (select * from(
select row_number() over(partition by Pid order by created desc) rowId,* from
table ) t
where rowId=1) tt
select * from (select * from(
select row_number() over(partition by Pid order by created desc) rowId,* from
table ) t
where rowId=1) tt