首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

求sql语句求和后比较,该怎么处理

2012-02-03 
求sql语句求和后比较select sum(raw) as raw from tabData where ID like T809 and ObservTime between

求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

热点排行