我已經創建下表MYSQL樞轉行
CREATE TABLE `demo` (
`id` int(11) DEFAULT NULL,
`A1` varchar(56) DEFAULT NULL,
`B1` varchar(56) DEFAULT NULL,
`C1` varchar(56) DEFAULT NULL,
`D1` varchar(56) DEFAULT NULL,
`E1` varchar(56) DEFAULT NULL,
`user_id` varchar(56) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
我插入查詢
INSERT INTO `demo` VALUES
(1,'a','b','c','d','d','10');
(2,'a','c','d','a','c','11');
(3,'a','d','d','a','c','12');
我的表結構後,接着就是在這裏 My table data
此我嘗試過以下
select `10`,`20`,`30` from
(
(select A1,B1,C1,D1,E1 from demo where id =1) as `10`,
(select A1,B1,C1,D1,E1 from demo where id =2) as `20`,
(select A1,B1,C1,D1,E1 from demo where id =3) as `30`
)as s
我收到以下錯誤
Error Code: 1064. You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to use
near 's' at line 6
請讓我知道我做錯了....或任何其他更好的方法來得到這個輸出
不好意思!這些是什麼? '一,二,三,四,五' – 1000111
我也不明白你的輸出! – 1000111
@SubrataDeyPappu @SubrataDeyPappu我已經更新了我的問題。請看看這個 – user3172982