我的表由OPEN_POS1列和另一列Lead_time_Bucket组成。我想在三个不同的列中找到所有OPEN_POS1与Lead_time_Bucket'0到15','16到30'和'> 30'的总和。但是输出对于下面的查询是不正确的。表别名不工作在mysql
select sum(x.OPEN_POS1) as '0-15',sum(y.OPEN_POS1) as '16-30',sum(z.OPEN_POS1) as '>30'
from `table 2` as x,`table 2` as y,`table 2` as z
where x.Lead_time_Bucket='0 to 15'
and y.Lead_time_Bucket='16 to 30'
and z.Lead_time_Bucket='> 30'
谢谢!它的工作! :) – 2014-09-24 10:56:22