美文网首页
Oracle按天、月份、年份查询

Oracle按天、月份、年份查询

作者: xhlc02 | 来源:发表于2018-07-23 18:29 被阅读0次

    //按天统计

    select count(*)

    from user

    group by trunc(你要按天查询的时间, 'DD'))

    //按自然周统计

    select to_char(date,'iw')

    from  user

    group by to_char(date,'iw')

    //按自然月统计

    select to_char(date,'mm')

    from   user

    group by to_char(date,'mm')

    //按季统计

    select to_char(date,'q')

    from  user

    group by to_char(date,'q')

    //按年统计

    select to_char(date,'yyyy')

    from  user

    group by to_char(date,'yyyy')

    友情链接:https://shop117143218.taobao.com/shop/view_shop.htm?spm=a313o.201708ban.category.d53.64f0197aXY7Er3&mytmenu=mdianpu&user_number_id=1070606134

    转载自:http://blog.csdn.net/u011659172/article/details/40186009

    相关文章

      网友评论

          本文标题:Oracle按天、月份、年份查询

          本文链接:https://www.haomeiwen.com/subject/oxncqftx.html