Home  >  Article  >  Database  >  T-SQL 行列互换

T-SQL 行列互换

WBOY
WBOYOriginal
2016-06-07 17:43:521194browse

对于一个简单的表, 两行两列(行号暂且不算). 要对它进行行列互换, 怎么做? 先准备测试数据: CREATE TABLE TempSum(n INT ,gender VARCHAR ( 10 ),total INT ); INSERT INTO TempSum(n, gender, total) VALUES ( , , 45 ); TempSum; n gender total male 23 2

对于一个简单的表, 两行两列(行号暂且不算). 要对它进行行列互换, 怎么做?

先准备测试数据:

CREATE TABLE TempSum( n INT, gender VARCHAR(10), total INT ); INSERT INTO TempSum(n, gender, total) VALUES (, , 45); TempSum;
n gender total
male 23 2 female 45 ,虚拟主机,香港服务器,香港空间

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn