库中有个日期型字段。存 2006-09-21 15:20:00现在在JSP里如何满足这个查询条件???列出 日期字段中包含2006-09 的所有数据请问这个条件怎么写啊????

解决方案 »

  1.   

    呵呵  不知道这个办法行得通不哈
    select * from table where substring(convert(varchar,'date 字段',120),1,7)='2006-09'
      

  2.   

    整复杂了,说白了就是9月份的数据嘛
    条件>2006-08-31 00:00:00 and <2006-10-01 00:00:00不就可以了
      

  3.   

    select * from table where substring(convert(varchar,'date 字段',120),1,7)='2006-09'
    这个可以吗???
      

  4.   

    select * from table where date like '2006-09%'
    这个就可以啊,也可以象楼上那样
    select * from table where substring(convert(varchar,'date 字段',120),1,7)='2006-09'