SQL问题高手看看

来源:百度知道 编辑:UC知道 时间:2024/07/17 23:33:41
有个表格式:
时间 名称 数量
------------------

我想查询名称为 "ABS" 时间在2006-11-1到2006-12-1之间的

对了的话追加分数 谢谢!!
我想查询 这个时间段内的总和数

select * from Table_name where 名称='ABS' and 时间>= '2006-11-1' and 时间 <= '2006-12-1'

select 名称,时间,sum(数量) as 总合数 from table where 名称='ABS' and (时间 >= #2006-11-1# and 时间 <= #2006-12-1#)

select count(*) from tab where 名称="ABS" AND 时间>=CAST('2006-11-1 00:00:01' AS datetime) AND 时间<=CAST('2006-12-1 23:59:59' AS datetime)

OK

select * from TABLE where TIME between to_date('2006-11-1 ','YYYY-MM-DD') and to_date('2006-12-1 ','YYYY-MM-DD') ;