خرید بک لینک

Vote count: 0

I have two tables

One is list of holidays school wise of January Month 2010

I want to calculate data of working days of all three schools in Jan 2010.

I took a just small example from real problem.

Holidays Table

SchoolID   HolidayOn    
1          01-01-2010        
1          02-01-2010    
2          01-01-2010   
2          02-01-2010   
3          01-01-2010   
3          02-01-2010     
3          03-01-2010

I want working days of All three schools

Output should be like this

SchoolID    WorkingDays
1           03-01-2010
1           04-01-2010
1           05-01-2010
1           06-01-2010
.
.
.
.
1           31-01-2010
2           03-01-2010
2           04-01-2010
2           05-01-2010
2           06-01-2010
.
.
.
2           31-01-2010
3           04-01-2010
3           05-01-2010
3           06-01-2010
3           07-01-2010
.
.
.
.
3           31-01-2010

I have tried something like this

  SELECT C.CalendarDate, H.HolidayOn
         FROM Calendar as C LEFT OUTER JOIN Holidays as H
    ON C.CalendarDate = H.HolidayOn
 WHERE H.HolidayOn IS NULL 
 AND YEAR(C.CalendarDate) IN (2011)
 GROUP BY C.CalendarDate, H.HolidayOn
 ORDER BY C.CalendarDate

How can I perform these on year basis as well ?

Thanks !!

asked 34 secs ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 24 فروردين 1395 ساعت: 13:08

صفحه بندی