Extract month name and year from timestamp to same column
I have a timestamp in the format: July 13, 2020, 6:07 PM
I would like to only keep the month and the year for my records. Ideally in the format: July, 2020
I've attempted the following that creates a column for each:
select
count(distinct my_id),
count(distinct my_loc),
to_char(created_at, 'month'),
date_part('year', created_at)
from acc_facts
group by created_at
The output is something like this (in 4 columns):
86 2 may 2,020
Could it be possible to get (in 3 columns):
86 2 May,2020
from Recent Questions - Stack Overflow https://ift.tt/3flDmPy
https://ift.tt/eA8V8J
Comments
Post a Comment