Original Question
I need to write a Microsoft SQL statement where I subtract a date from number of days from another table. So, essentially, the table example is below:
Table 1 (date) Table 2 (number of days)
2013-05-08 23:59:13.000 7
2013-05-08 23:59:16.000 7
2013-05-08 23:59:06.000 7
Any help would be appreciated.
Updated Question
The only two item I have to work with is the following information:
I need to know how long an invoice has been in the invoice queue. TimeoutDate is when the invoice will timeout of the queue, and TimeOutDays is the length of days this queue is given before it times out, but it's business days, so excluding weekends.
So, if you calculate based on this information, the invoice has been in the queue for 8 business days <-- this is the answer I need to get from the query.
Extra Information
The invoice entered into the system 04/30/2013, but since the webapp does not count the day the invoice entered the system, the time-out counter starts the day after, which is 05/1/2013. Hope this explains a little clearer!
I have a quick query, but that's not going to help, since it doesn't show what I need, but in effect below is the results of what I need: