您的位置:程序门 -> db2 -> 基础类



db2在where怎么根据日期条件查询呢?


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


db2在where怎么根据日期条件查询呢?[已结贴,结贴人:kinglx520]
发表于:2007-12-10 10:46:25 楼主
很简单的一条语句,为什么不能执行?
select   *   from   enterprise   where   edate='2007-12-7'
把where后面删除就可以了,应该是edate='2007-12-7'这条语句的问题。
发表于:2007-12-10 10:51:171楼 得分:0
补充一下,edate字段是timestamp类型
发表于:2007-12-10 11:08:412楼 得分:50
是字段类型与值不兼容,如果只需判断日期,用date(edate)取出edate中的日期数据。
发表于:2007-12-10 11:14:123楼 得分:0
select       *       from       enterprise       where       year(edate)=2007   and   month(edate)=12   and   day(edate)=7
发表于:2007-12-10 11:20:334楼 得分:0
elect       *       from       enterprise       where       date(edate)='2007-12-7'  
发表于:2007-12-10 13:51:115楼 得分:0
谢谢


快速检索

最新资讯
热门点击