我在数据库中有一张表:t_contruction 表中有一个字段是:apply_date是date类型的,现在我想要查出在2006年上交的一些数的总数如何写sql?其中apply_date中的数据形式是:2006-9-21 下午 06:06:50
请大家帮助啊!

解决方案 »

  1.   

    select count(*) from t_contruction where Year(apply_date)>2006
      

  2.   

    select sum(1) from biao where  left(convert(varchar(19),列,121),4)
      

  3.   

    回天若有晴:我这样做了可year是不存在啊
    两个都用了还是错啊
    sunjay117那个里面要什么表达式吗?
      

  4.   

    select * from t_contruction where datepart(yy,AddTime)='2006'
      

  5.   

    select * from t_contruction where datepart(yy,apply_date)='2006'
      

  6.   

    Oracle中可以使用to_char([date],'YYYY')='2006'来判断
      

  7.   

    可以有一个例子吗,我这样写的:select count(*) from t_construction where to_char(apply_date,'yyyy')='2006'出错是没有表达式
      

  8.   

    select to_char(apply_date,'yyyy') from t_construction