select sum("NUMBER") as WEEK_NUMBER, COMPANY_CODE, PROJECT_CODE from D_VISIT WHERE "DATE" >= (TO_DATE('2014-03-29','yyyy-mm-dd') - (mod(TO_NUMBER(to_char(TO_DATE('2014-03-29','yyyy-mm-dd'),'D'))+7-2,7)) ) AND "DATE" <= TO_DATE('2014-03-29','yyyy-mm-dd') group by COMPANY_CODE, PROJECT_CODE
主要是计算本周的算法哈