jeudi 19 mars 2015

partition over weeks sql 2005

I have in table two columns with dates. One date represent expected date and other one date when job is finished. I want to make query to get how many jobs were finished including specific week in current year and how many jobs should be finished to that week.


So if I transform my dates in weeks in those two colums as:



wkx:7,7,7,8,8,9,10,10,10,10,11,11
wkf:7,8,10,10,12,13,14,15,16,17,18,19


response should be smth like:



wk:7,8,9,10,11,12,13,14,15,16,17,18,19
numx:3,5,6,10,12,12,12,12,12,12,12,12,12
numf:1,2,2,4,4,5,6,7,8,9,10,11,12


I am using MS SQL 2005, and have no idea even how to get distinct weeks in one column as is in example. regards


Aucun commentaire:

Enregistrer un commentaire