select max(iif(Time = 1, Amount,cast(0 as N(10)) as [a1],; max(iif(Time = 2, Amount,cast(0 as N(10)) as [a2],; max(iif(Time = 3, Amount,cast(0 as N(10)) as [a3]; from myTable; GROUP BY NumberIt would be perfect but when I tried and it worked unfortunately only with positive numbers.