我的表由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