How to select a year from a date?

Hi, I have a problem I need to extract year from date, how can this be done with SQL query?
This query doesn't work:

spr3<-sqldf("select year(mydate) from table")

Depends on the SQL platform you are using and the format of the date. Can you provide more detail.
You want to consider using Lubridate. Its an R package that is part of the tidyverse series that handles many date manipulation functions.

This should work for MySQL/MariaDB.

What is the underlying database?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.