Pivot rows to columns without aggregate
The PIVOT function requires an aggregation to get it to work. It appears that your VAL column is a varchar so you will have to use either the MAX or MIN aggregate functions. If the number of tests is limited, then you can hard-code the values: select sbno, Test1, Test2, Test3 from ( select test_name, … Read more