I am trying to create a query that gets only the year from selected dates. I.e. select ASOFDATE from PSASOFDATE; returns 11/15/2012, but I want only 2012. How can I get only the year? I know the YEAR function can be used, but I’m not sure how.
I am trying to create a query that gets only the year from selected
Share
Edit: due to post-tag ‘oracle’, the first two queries become irrelevant, leaving 3rd query for oracle.
For MySQL:
Editted:
In anycase if your date is a String, let’s convert it into a proper date format. And select the year out of it.
Since you are trying Toad, can you check the following code:
For Oracle:
Reference: