求sql语句求和后比较
select sum(raw) as raw from tabData where ID like 'T809' and ObservTime between '2011-06-05 11:52:57' AND '2011-06-06 11:52:57'
想将sum(raw) as raw这点判断一下大于多少
select sum(raw) as raw from tabData where ID like 'T809' and ObservTime between '2011-06-05 11:52:57' AND '2011-06-06 11:52:57' order by raw desc
order by raw desc不起作用了。why?
[解决办法]
select sum(raw) as raw from tabData where ID like 'T809' and ObservTime between '2011-06-05 11:52:57' AND '2011-06-06 11:52:57'
想将sum(raw) as raw这点判断一下大于多少
select sum(raw) as raw from tabData where ID like 'T809' and ObservTime between '2011-06-05 11:52:57' AND '2011-06-06 11:52:57' having sum(raw)>你的值
试试
select sum(raw) as raw from tabData where ID like 'T809' and ObservTime between '2011-06-05 11:52:57' AND '2011-06-06 11:52:57' order by 1 desc
[解决办法]
select sum(raw) as raw
from tabData
where ID like 'T809'
and ObservTime between '2011-06-05 11:52:57' AND '2011-06-06 11:52:57'
order by sum(raw) desc