我想总结多行选择ID我的代码是
SELECT sum(yellow) AS yellow,
sum(orange) AS orange,
sum(red) AS red,
sum(blue) AS blue,
sum(green) AS green,
sum(purple) AS purple
FROM main
WHERE ID IN ('180 , 182')
但是获得第一个ID只是不加两者。
答案 0 :(得分:0)
将您的查询修改为
SELECT sum(yellow) AS yellow,
sum(orange) AS orange,
sum(red) AS red,
sum(blue) AS blue,
sum(green) AS green,
sum(purple) AS purple
FROM main
WHERE ID IN ('180' , '182');
^ ^
Place single quotes here