sql 行转列
SELECT sss FROM (SELECT TOP (1) 1 AS Expr1, A AS sss FROM com_jjxx UNION SELECT TOP (1) 2 AS Expr1, B AS aaaa FROM com_jjxx AS com_jjxx_5 UNION SELECT TOP (1) 3 AS Expr1, C AS bbb FROM com_jjxx AS com_jjxx_4 UNION SELECT TOP (1) 4 AS Expr1, D AS ccc FROM com_jjxx AS com_jjxx_3 UNION SELECT TOP (1) 5 AS Expr1, E AS ddd FROM com_jjxx AS com_jjxx_2 UNION SELECT TOP (1) 6 AS Expr1, F AS eeee FROM com_jjxx AS com_jjxx_1) AS a
有必要解释一下... 1,2,3,4,5,6, 就是就要显示的内容的一个排序.. A,B,C,D,E,F 就是要显示的内容.当然, com_jjxx 这个表里面要有这些字段. com_jjxx 后面也可以加WHERE 条件...
相关推荐
专注前端开发 2020-10-21
苏康申 2020-11-13
vitasfly 2020-11-12
oraclemch 2020-11-06
liuyang000 2020-09-25
FellowYourHeart 2020-10-05
赵继业 2020-08-17
whyname 2020-08-16
Seandba 2020-08-16
dbasunny 2020-08-16
拼命工作好好玩 2020-08-15
langyue 2020-08-15
写程序的赵童鞋 2020-08-03
Accpcjg 2020-08-02
tydldd 2020-07-30
好记忆也需烂 2020-07-28
jianghero 2020-07-28