大概情况是把累计购买大于200元的ID筛选出来,但是
select ID,sum(total) as Atotal from sales where Atotal>200 group by ID
错误提示:Invalid column name 'Atotal'
难道不能以sum后的字段名筛选吗?
------解决思路----------------------
不能
select ID,sum(total) as Atotal from sales group by ID
HAVING sum(total) >200
OR
SELECT * FROM(
select ID,sum(total) as Atotal from sales group by ID
)T
WHERE where Atotal>200