thursday'snotes
this site the web

Lesson #4 Creating Crosstab Query

PIVOT : merotasi tabel dengan mengubah unique value table dari 1 kolom  pada expression menjadi banyak kolom dan menunjukan agregasi. Pivot bekerja dengan mengambil nilai misalnya EmployeeID dan mentraslate mereka ke kolom biasa digunakan untuk memciptakan cross tab report.

 contoh :  SELECT * FROM [table] PIVOT (SUM ([sum kolom e.g :Qty]) FOR [kolom name e.g : Prod] IN ([header kolom baru1], [header kolom baru 2])) PVT

UNPIVOT : berlawanan dengan pivot dimana merotasikan kolom sari sebuah table-valued  expression menjadi kolom values

contoh :  contoh :  SELECT * FROM [table] UNPIVOT ([sum kolom e.g :Qty] FOR [kolom name e.g : Prod] IN ([header kolom lama1], [header kolom lama 2])) UnPVT

0 comments:

Post a Comment

 

Disclaimer

I do not claim any of these images as my own unless otherwise stated

The views and opinions expressed on this blog are 100% mine. If I claim or appear to be an expert on a certain topic or product or service area, I will only endorse products or services that I believe, based on my expertise, are worthy of such endorsement. Any product claim, statistic, quote or other representation about a product or service should be verified with the manufacturer or provide

About Thursday's Notes

This blog is a personal blog written and edited by me, and does not reflect the views of either employers and/or clients. This blog does not accept any form of cash advertising, sponsorship, or paid topic insertions.