简体   繁体   中英

SQL Server PIVOT functionality

如果我们PIVOT任何表和UNPIVOT该表,我们得到我们的原始表?

No, will not always get the same table as the original table. It depends on the kind of data that we are looking at.

Check the SQL Fiddles for @Mahmoud Gamal 's data.

SQL Fiddle With SUM

SQL Fiddle With MAX

No you can get different result. because use aggregate function in pivote. and when you unpivote pivoted query maybe get different result, that such as aggregated orginal table on pivote fields.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM