Hello, we have a mixed environment of SQL server 2008 R2 and 2012. All using express versions on our various servers. I pull monthly reports in SQL Server Management Studio for users that show project data based on dates and whether those particular projects are overdue or nearing a deadline.
My query is a moderately simple Select query with inner joins and a Where clause. Among the fields selected is a due date field. What I have been doing thus far is export the results to excel and then add 3 columns to use excel formulas:
determine if due date is less than today's date (True or False)
indicate if project is overdue (Yes or No)
and also to count the number of days between the due date and today's date which can be positive or negative value. So if the due date was 10 days before today's date, then it would show -10, but if it was 10 days after today's date, it would show 10.
And then lastly, I would sort the list based on if it was overdue and how many days it was past due.
So my question is this, is it possible to do all of this in a Select Query without having to make these modifications in Excel? Whereas the report would already have the 3 columns added with the conditions above?