Hi @VaralaxmiPandikonda-4750,
Please refer to:
DECLARE @prod TABLE (id int, abr int, ubr int)
INSERT INTO @prod
VALUES
(1 , 1 , 0),
(1 , 0 , 1),
(2 , 0 , 1),
(2 , 1 , 0)
;with cte
as(select id,case when abr=0 then ubr else abr end abr,case when ubr=0 then abr else ubr end ubr,
row_number() over(partition by id order by id)rn
from @prod)
select id,abr,ubr from cte
where rn<2
If you have any question, please feel free to let me know.
If the response is helpful, please click "Accept Answer" and upvote it.
Best Regards
Echo
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.