I have posted this problem ago but I guess I wasn't able to be as clear as I should have. I want to calculate difference between 2 dates let's say
I have a table
Calendar which is storing what day is a holiday and what is not. I am marking Sunday and Saturday as holidays, and want to calculate the working days remaining which should be 23.
But what actually the problem is that I can also mark Sunday as holiday and not Saturday.
That's why I want to use this table as well. I see so many solutions that are giving me 23 result because they are marking Sunday and Saturday as holiday which is fine too but I want it to be using this table as well.
I tried much but I'm sure where I am going wrong. Maybe somebody can help now.
Table is like this
CREATE TABLE Calendar
Day Varchar(25), --name of the day i.e Sunday, Saturday
IsOffDay Binary --1 for Yes and 0 for False
So if I mark Saturday and Sunday as holiday the result should be 23 days but if I only mark Sunday as holiday and make Saturday inactive then it should be 27 days
The proposed solution that one mate says is possible duplicate is getting Saturday and Sunday as holiday but I don't want that to be hard coded or whatever you say.