How to Pivot Your Data in T-SQL for SQL Server - Static and Dynamic Column Examples

Опубликовано: 10 Декабрь 2021
на канале: Sean MacKenzie Data Engineering
3,268
70

In this episode, we're going to look at how to pivot your data in SQL Server T-SQL queries. Pivoting is a very useful way of transforming data, and one of the most effective ways to show summary data. First I'll show you how to do a pivot query with static columns, and then I'll show you a more advanced method that will allow you to have a dynamic display of an unknown number of columns. This tutorial will also introduce you to the STRING_AGG function, which simplifies the creation of a delimited list in SQL Server 2017+ and Azure SQL environments.

Interested in transforming your career or finding your next gig?
https://system.billzone.com/careers.html

Want my team to do a project for you? Let's get to it!
https://system.billzone.com/smdeproje...

Want to get access to premium content made just for you and have a chat with me? Find me on Patreon :

  / mackenziedataengineering  

Demo of my BZ RDP Cloaker:
https://www.patreon.com/posts/how-to-...



Want to work with me 1:1? Contact me today and book your free 20 min consultation!

Contact form you can find at http://www.mackenziemackenzie.com/

Follow me on social media:
  / mackenziedataanalytics  
  / seamacke  
  / seamacke  
  / seamacke  
  / psmackenzie  

Get Microsoft Office including Access:
https://click.linksynergy.com/fs-bin/...

Got a YouTube Channel? I use TubeBuddy, it is awesome. Give it a try:
https://www.tubebuddy.com/seanmackenz...


#sqlserver #pivot #tsql

   • How to Pivot Your Data in T-SQL for S...