select count(*) as countno from tgrht where (Fxb=1) and (TZZ_ID=1) and (fhtzzrq<'2007-09-12') 为什么出错,报类型不匹配错误。应该是日期那里,但是用to_date却说没有这个函数,有没别的办法?Fxb和TZZ_ID 分别是数值型 fhtzzrq为日期型字段高手帮帮忙
select count(*) as countno from tgrht where (Fxb=1) and (TZZ_ID=1) and (fhtzzrq<'2007-09-12') 为什么出错,报类型不匹配错误。应该是日期那里,但是用to_date却说没有这个函数,有没别的办法?Fxb和TZZ_ID 分别是数值型 fhtzzrq为日期型字段高手帮帮忙 ---------------- 时间可以这样比较呀! 另外,SQL里用cast('2007-09-12' as datetime) 或convert(datetime,'2007-09-12',120)可以转化时间
select count(*) as countno from tgrht where (Fxb=1) and (TZZ_ID=1) and (DATEDIFF(DAY,fhtzzrq,'2007-09-12')>0) 看看這個可以不 你的應該也沒有問題啊
時間可以這樣比較 SELECT * FROM sysobjects WHERE crdate<'2007/10/1' /*(2680 row(s) affected)*/
select count(*) as countno from tgrht where (Fxb=1) and (TZZ_ID=1) and (fhtzzrq<'2007-09-12') 日期应该没错 是前面两个错了吧试试 select count(*) as countno from tgrht where (Fxb=1) and (TZZ_ID=1) 与 select count(*) as countno from tgrht where (fhtzzrq<'2007-09-12') 就知道了
还是不行 select count(*) as countno from tgrht where (Fxb=1) and (TZZ_ID=1) 这条没问题 select count(*) as countno from tgrht where (fhtzzrq<'2007-09-12') 这条有问题 提示:标准表达式中数据类型不匹配我用的是delphi是不是跟这个有关系??
select count(*) as countno from tgrht where (fhtzzrq<'2007-09-12') 这条有问题--try select count(*) as countno from tgrht where (fhtzzrq<cast('2007-09-12' as datetime))
select count(*) as countno from tgrht where (fhtzzrq<cast('2007-09-12' as datetime))也不行,出现“未指定的错误”提示
数据库是.mdb的 编程软件是delphi,应该都没关系吧?
select count(*) as countno from tgrht where fhtzzrq > #2007-09-12# 这样子搞定了,呵呵,谢谢大家了
----------------
时间可以这样比较呀!
另外,SQL里用cast('2007-09-12' as datetime) 或convert(datetime,'2007-09-12',120)可以转化时间
看看這個可以不
你的應該也沒有問題啊
SELECT * FROM sysobjects WHERE crdate<'2007/10/1'
/*(2680 row(s) affected)*/
and (fhtzzrq<'2007-09-12')
日期应该没错
是前面两个错了吧试试
select count(*) as countno from tgrht where (Fxb=1) and (TZZ_ID=1)
与
select count(*) as countno from tgrht where (fhtzzrq<'2007-09-12')
就知道了
select count(*) as countno from tgrht where (Fxb=1) and (TZZ_ID=1) 这条没问题
select count(*) as countno from tgrht where (fhtzzrq<'2007-09-12') 这条有问题
提示:标准表达式中数据类型不匹配我用的是delphi是不是跟这个有关系??
select count(*) as countno from tgrht where (fhtzzrq<cast('2007-09-12' as datetime))
编程软件是delphi,应该都没关系吧?