SQL Server Convert Row to Column using Pivot

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

Chandra Oemaryadi has written 244 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>