Sunday, May 26, 2013

SQL Filter A Set of Records At latest revision

Use CTE to do it, like



with cte as
(select group,product,revision,row_number () over (partition by group order by revision desc) rn
from tab1)
select b.group,b.product,b.revision
from cte a,tab1 b
where rn=1
and a.group=b.group
and a.revision=b.revision;






Many Thanks & Best Regards, Hua Min





No comments:

Post a Comment