Wednesday, July 2, 2014

creating a view problem with revision

Try row_number()



select * into temp12 from
(select '1' col1,'A' col2,'1' col3 union all
select '1','B','1' union all
select '1','A','2'union all
select '2','B','2') a


Create view v11
as
select * from
(select row_number() over(partition by col2 order by col3) rno, * from temp12) a
where rno=1

select * from v11


No comments:

Post a Comment