my input is :
PID PDate col2 source1 source2 1 20200324 24 AAA BBB
And i am expecting below output:
PID PDate col2 source 1 20200324 24 AAA 1 20200324 24 BBB
I tried using cross apply but not getting right output. Can anyone please help me?
Advertisement
Answer
UNION is the right way to solve this:
SELECT PID, PDate, col2, source1 as source FROM yourtable UNION ALL SELECT PID, PDate, col2, source2 FROM yourtable