Having DDL
CREATETABLE#ServiceChange([ID][int]identity(1,1),[SHCOMP][char](2)NOTNULL,[SHCRTD][numeric](8,0)NOTNULL,[SHCUST][numeric](7,0)NOTNULL,[SHDESC][char](35)NOTNULL,[SHTYPE][char](1)NOTNULL,[SHAMT][numeric](9,2)NOTNULL,[CBLNAM][char](30)NOTNULL,[GROUPID][char](2)NULL)
And original and desire data in below link
https://www.dropbox.com/sh/bpapxquaae9aa13/AADnan31ZASublDjN7sa2Vvza
I would like to know how can I modify one column of current and next record depending of some criteria using SQL2012?
The criteria is:
Type should always flow F->Tifcurrent abs(amount)> next abs(amount)then groupid ='PD'ifcurrent abs(amount)< next abs(amount)then groupid ='PI'
there is no casewhen those amounts will be equalswherecurrent(custid)= next(custid)andcurrent(service)= next(service)and groupid isnull
Any help will be really apreciated.
Thank you