Evan Traverso February 2016
Extracting year from a date timestamp in SQL
I am trying to convert a column in a database into a timestamp format, then I want to see the number of counts for each year.
EXTRACT(YEAR FROM column_name)
GROUP BY column_name;
'I get an error message that says no function matches the given name and argument types. You might need to add explicit type casts.'
Is extract the wrong function?
Juan Carlos Oropeza February 2016
You probably want something like this if
column_name is timestamp
search for EXTRACT documentation
EXTRACT(YEAR FROM column_name), count(*)
GROUP BY EXTRACT(YEAR FROM column_name);
column_name is string you need to_timestamp() function
Asked in February 2016
Viewed 1,446 times
Answered 1 times
Leave an answer
Quote of the day: live life