postgresql - Extracting year from a date timestamp in SQL -


i trying convert column in database timestamp format, want see number of counts each year.

i have:

select     (column_name::date), count(*)     extract(year column_name) table group column_name; 

'i error message says no function matches given name , argument types. might need add explicit type casts.'

is extract wrong function?

you want if column_name timestamp

search extract documentation

select     extract(year column_name), count(*)         table group extract(year column_name); 

if column_name string need to_timestamp() function


Comments

Popular posts from this blog

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -