How to query GROUP BY Month in a Year

后端 未结 5 826
情书的邮戳
情书的邮戳 2021-02-01 01:07

I am using Oracle SQL Developer. I essentially have a table of pictures that holds the columns:

[DATE_CREATED(date), NUM_of_PICTURES(int)]

and if I do a select *

5条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-01 01:46

    For MS SQL you can do this.

        select  CAST(DATEPART(MONTH, DateTyme) as VARCHAR) +'/'+ 
    CAST(DATEPART(YEAR, DateTyme) as VARCHAR) as 'Date' from #temp
        group by Name, CAST(DATEPART(MONTH, DateTyme) as VARCHAR) +'/'+
     CAST(DATEPART(YEAR, DateTyme) as VARCHAR) 
    

提交回复
热议问题