Skip to content
Advertisement

Get query results for all date values besides current month

I need to get values for data excluding current month and taking this year into account.

What I currently have is the following

Obviously this will also exclude 2018 current month data as well which I want to prevent.

I’ve checked different solutions online but failed to apply it.

Advertisement

Answer

I would simply do:

This is also sargable — a mouthful that means that an index can be used for the query.

You can also write this as:

This is actually better and clearer.

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