tablename
pid
select * from tablename where pid not in (select top 5 pid from tablename order by pid desc)
with tmp as( select color, row_number() over (partition by date order by date) rn from TableA ) select * from tmp where rn > 5
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)