A
AFSSkier
Is there a more efficient syntax to convert today's date -7 days to week
YYYYWW (last week), then the SQL below? Result = 200847
WHERE (((a11.week_id)=Format(Date()-7,"yyyy") &
Format(Format(Date()-7,"ww"),"00"))) This took 16 mins.
Replaced hardcode: WHERE (((a11.week_id) In (200847))) This took only 5 secs.
SELECT DISTINCT a12.department_id, a13.department_desc,
(0.001+Nz(Sum(a11.sales_d_r52w),0)) AS Sales_D
FROM (division_r52w AS a11 INNER JOIN p_item AS a12 ON a11.item_id =
a12.item_id) INNER JOIN p_department AS a13 ON a12.department_id =
a13.department_id
WHERE (((a11.week_id)=Format(Date()-7,"yyyy") &
Format(Format(Date()-7,"ww"),"00")))
GROUP BY a12.department_id, a13.department_desc, a11.week_id
ORDER BY a12.department_id;
YYYYWW (last week), then the SQL below? Result = 200847
WHERE (((a11.week_id)=Format(Date()-7,"yyyy") &
Format(Format(Date()-7,"ww"),"00"))) This took 16 mins.
Replaced hardcode: WHERE (((a11.week_id) In (200847))) This took only 5 secs.
SELECT DISTINCT a12.department_id, a13.department_desc,
(0.001+Nz(Sum(a11.sales_d_r52w),0)) AS Sales_D
FROM (division_r52w AS a11 INNER JOIN p_item AS a12 ON a11.item_id =
a12.item_id) INNER JOIN p_department AS a13 ON a12.department_id =
a13.department_id
WHERE (((a11.week_id)=Format(Date()-7,"yyyy") &
Format(Format(Date()-7,"ww"),"00")))
GROUP BY a12.department_id, a13.department_desc, a11.week_id
ORDER BY a12.department_id;