表Table1中有 日期字段TestDate,现在想按照天查询。
但是MySQL不支持TestDate=?。该如何写呢?
select * from Table1 where testdate .......?谢谢大家!

解决方案 »

  1.   

    你的代码是什么?为什么不支持TestDate=?
      

  2.   

    MySQLSELECT qrybearing_even.Product_Number, QryBearing_Even.TestTime AS 检测时间
    FROM qrybearing_even
    WHERE (QryBearing_Even.TestDate=?)
      

  3.   

    select * from Table1 where testdate between '2011-09-15' and '2011-09-16';
      

  4.   

    你那个?的是jdbc吧,没什么问题啊,只要参数设置正确,可以的啊,不过最好是设置java.sql.Date类型
      

  5.   

    select * from Table1 where testdate=‘2011-09-15'
      

  6.   

    如果你表中日期是带时间的。则可以select * from Table1 where date(testdate)=‘2011-09-15'
    或者考虑到利用索引则select * from Table1 where testdate between '2011-09-15' and '2011-09-15 23:59:59';
      

  7.   

    select * from Table1 where testdate=date_format(‘2011-09-15','%Y-%M-%d')
    是这个意思吗
      

  8.   

    表table1中 字段1    字段2   
               aaa     2011-9-1
               bbb     2011-9-2
               ccc     2011-9-3
    数据库用的mysql,现在我想得出 select * from table1 where 字段2=?  所查询得到的数据,
    但是提示  ?  错误。 
    但是在access里是可以运行的,请教大家该如何写呢?
      

  9.   

    select * from table1 where 字段2='2011-09-01'
      

  10.   

    编写SP,将日期做为参数传递进去
    create procedure ff(aa datetime)
    begin
    select * from table1 where 字段2=aa
    endcall ff('2011-09-01')