I am getting error "b" does not match table
;With test as (select row_number() over (order by hreid) as slno,hreid,b.value as checks from datatbl A)cross apply fn_split(a.Checks,',') as b),b as(select row_number() over (order by hreid) as slno,hreid,b.value as cost from datatbl A)cross apply fn_split(a.cost,',') as b)Select c.checks,b.cost
From test c
PIVOTE (min(b.cost) for c.checks in(employeement,education,..)Pvt
Inner join b on c.hreid=b.hreid and c.slno=b.slno
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Vinay SinghRank #604 · 4K reputationPosted Mar 26, 2020, 5:41 AM EDT