Sql transpose rows to columns. pivot_table function, but using only SQL.