Skip to content
Advertisement

SQL – Get result of current year only

How can I get the result of the current year using SQL?

I have a table that has a column date with the format yyyy-mm-dd.

Now, I want to do select query that only returns the current year result.

The pseudo code should be like:

The result should be as following:

How can I do this?

Advertisement

Answer

Use YEAR() to get only the year of the dates you want to work with:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement