踏实,努力向上!

时间相关的查询

上一篇 / 下一篇  2008-01-05 15:48:12 / 个人分类:SQL

1、查询超过'2007-07-30'的所有注册客户的信息
select   *   from   customer   where  RegTime>convert(datetime,'2007-07-30')
2、按月统计2007年所有的订单
select count(*),month(orderdatetime)as months
from order
where year(orderdatetime)='2007'
group by month(orderdate)
3、查看2007年5月份的所有订单
select count * as '5月'
from order
where month(OrderDatetime)=5 and year(OrderDate)=2007

 


TAG: SQL

 

评分:0

我来说两句

Open Toolbar