使用ODBC联接数据库查询日期大家知道SQL要怎么写吗?
我这样子写哪里出错了
select hmb_dh,hmb_jh, hmb_jyrq, hmb_fkfs, hmb_fkkh, hmb_fkje, hmb_yhfs, hmb_yhkh, hmb_yhje, hmb_jyfs, hmb_gh, hmb_jysj from zbmbjy where 1=1 and hmb_jyrq Between '2005-2-8' and '2005-2-8'

解决方案 »

  1.   

    说明一下。我是使用VFP的数据库搞了N久也没有试出来
      

  2.   

    加两个括号就可以了:
    select hmb_dh,hmb_jh, hmb_jyrq, hmb_fkfs, hmb_fkkh, hmb_fkje, hmb_yhfs, hmb_yhkh, hmb_yhje, hmb_jyfs, hmb_gh, hmb_jysj from zbmbjy where (1=1) and (hmb_jyrq Between '2005-2-8' and '2005-2-8')
      

  3.   

    不行哦。我试过了N次了。。在两边加上#或者不使用between使用大于小于都不可以。。
      

  4.   

    Vfp数据库中日期字段查询的格式为:
    eg
    select * from tablename where 日期={^2003-05-28}
      

  5.   

    select hmb_dh,hmb_jh, hmb_jyrq, hmb_fkfs, hmb_fkkh, hmb_fkje, hmb_yhfs, hmb_yhkh, hmb_yhje, hmb_jyfs, hmb_gh, hmb_jysj from zbmbjy where 1=1 and hmb_jyrq Between DateValue('2005-2-8') and DateValue('2005-2-8')试试这样行不行?
      

  6.   

    naner_china(naner)
    方法可行。。谢谢。。