top of page
  • Google+ Social Icon
  • Twitter Social Icon
  • LinkedIn Social Icon
  • Facebook Social Icon

Update Second Row if two rows has same values


Here i want to Update the Second repeated digit Like (3 as 6) without any Unique column.

As per above given attach.

Query :

create table #temp(Item int)

insert into #temp values(3)

insert into #temp values(5)

insert into #temp values(Null)

insert into #temp values(8)

insert into #temp values(Null)

insert into #temp values(3)

select * from #temp

WITH MyTable AS

(

SELECT Item,

ROW_NUMBER() OVER ( ORDER BY Item ) AS 'RowNumber'

FROM #temp

)

update MyTable set item=6 where RowNumber=3

--SELECT RowNumber,item

--FROM MyTable

--WHERE Item = 3

select * from #temp


RECENT POST
  • Grey Google+ Icon
  • Grey Twitter Icon
  • Grey LinkedIn Icon
  • Grey Facebook Icon

© 2023 by Talking Business.  Proudly created with Wix.com

​

bottom of page