Skip to content
Advertisement

Join two columns as a date in sql

I am currently working with a report through Microsoft Query and I ran into this problem where I need to calculate the total amount of money for the past year.

The table looks like this:

How would you calculate the total amount from 02-2019 to 02-2020 for the item number 12345?

Advertisement

Answer

Assuming that you are running SQL Server, you can recreate a date with datefromparts() and use it for filtering:

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