Implementing Date Calculations in SQL


Problem

A few weeks back, I was working on a report for one of my clients who were using a desktop application as a client tool with SQL as the database. The module on which I was working had a reporting functionality that displayed the Sales Amount by categories that had taken place during a specific date as selected by the user.

If you see the screen print below (Fig 1), you can see that there are two dropdowns in the application – Period Start Date and Period End Date. The user has to fill in these two fields in order