a表
id   name   dateTime
1     aa     2009-9-9
2     bb     2009-9-10
3     cc     2009-9-11
4     dd     2009-9-44
5     jj     2009-9-10
查询列dateTime中的值2009-9-11以后的值
应该怎么写啊

解决方案 »

  1.   

    select * from table where dateTime > to_date('2009-9-11','yyyy-m-dd')
      

  2.   

    select * from a where datediff(day,dateTime,'2009-9-11')<0
      

  3.   

    1楼的貌似是Oracle里的sql语句吧
    2楼的没见过,学习一下!
      

  4.   

    String 类型的话,直接>就行了
      

  5.   

    select * from table where id>(select id from table where dateTime="2009-9-11")
      

  6.   

    string 类型的话 直接>就行额
      

  7.   

    select * from table where dateTime > to_date('2009-9-11','yyyy-m-dd')
    这个结果会把2009-9-11那天的结果查出吧。
    select * from table where dateTime > to_date('2009-9-11 23:59:59','yyyy-m-dd hh24:mi:ss')
      

  8.   

    select * from table where dateTime > to_date('2009-9-11','yyyy-m-dd')
      

  9.   

    如果dateTime 是时间类型的话需要转换比较下,如果是字符串的话那就直接大于就行了
    select * from table where dateTime > to_date('2009-09-11','yyyy-mm-dd')
      

  10.   

    select * from table where dateTime >'2009-09-11 00:00:00' 
      

  11.   

    为什么是String可以比较,应该是Data类型的可以比较吧
      

  12.   

    1楼正解 
    select * from table where id>(select id from table where dateTime="2009-9-11")
    错解。string类型比较也错解。
      

  13.   

    mysql数据库sql语句:SELECT * FROM table_name WHERE DATEDIFF(dateTime_fieldname,'2009-9-11')>0
      

  14.   

    日期是可以直接大小比较的还有五楼,这并非貌似Oracle中的sql语句,SQL Server同样的有
      

  15.   

    如果你数据库中dateTime 格式是date格式,二楼这个可以
    如果是String
    那直接比较就可以了
    select * from table where dateTime > '2009-9-11'