This article is a mirror article of machine translation, please click here to jump to the original article.

View: 15872|Reply: 0

[Source] sqlserver Horizontal Table to Vertical Table (Row to Column)

[Copy link]
Posted on 4/16/2018 5:36:19 PM | | | |
Topic: Vertical table to horizontal table

Solution:


SQL statement:
Legacy Questions:
usepivot in cannot be subqueried.


Horizontal to vertical table:
Horizontal table structure Table_B --> Vertical table structure Table_A

Method 1:union all
Method 2: using unpivot












Previous:Solutions for conflicts between Hyper-V and VirtualBox and VMware
Next:IIS6 MVC4 Route Failure Inaccessible Workaround
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com