I'm working on PostgreSQL with SQL.
I have a column date that is a string and I want to extract the month:
I tried:
SELECT EXTRACT(MONTH FROM cast(date as date)) FROM table_name ;
I got:
ERROR: ERREUR: syntaxe en entrée invalide pour le type date : « janvier 2020 »
Can anyone help me please?
CodePudding user response:
try
select
split_part(date, ' ', 2) as month
from table_name
.