orcale怎样在这两个字段中间取我想要的日期,
表名是rec_main_consume

解决方案 »

  1.   

    uploaddate>=2018/01/01 and uploaddate<2018/12/31 ?
      

  2.   

    日期转换啊
    uploaddate>=to_date('2018-01-01','yyyy-mm-dd') and uploaddate<to_date('2018-12-31','yyyy-mm-dd')
      

  3.   

    select * 
    from  rec_main_consume
    where uploaddate between to_date('2018-01-01','yyyy-mm-dd') and  to_date('2018-12-31','yyyy-mm-dd')
      

  4.   

    以下代码返回2018年的所有日期,仅供参考。
    SELECT
        TO_DATE('2018/01/01','YYYY/MM/DD') + level - 1
    FROM
        dual
    CONNECT BY
        level <= TO_DATE('2018/12/31','YYYY/MM/DD') - TO_DATE('2018/01/01','YYYY/MM/DD') + 1;
      

  5.   

    select * from  rec_main_consume
    where to_char(uploaddate,'yyyy') = '2018';
      

  6.   

    uploaddate between to_date('2018/01/01','yyyy/mm/dd') and to_date('2018/12/31','yyyy/mm/dd')