Mengubah baris menjadi kolom pada SQL Server menggunakan pivot
[code lang=”sql”]
select order_media_mlr_id, DESIGN, LOCATION
from
(
select order_media_mlr_id, category, modified_time
from order_media_mlr_logs
where status = ‘READY_TO_SHOW’
) d
pivot
(
max(modified_time)
for category in (DESIGN, LOCATION)
) piv;
[/code]
https://stackoverflow.com/questions/15931607/convert-rows-to-columns-using-pivot-in-sql-server