melaniecarr23
Programmer
I have an update query that will update if the fields have already been updated previously, but won't if it's a new record.
Does this not update fields in the plan_calculations table as long as the plan_calculations.costid = costs.cost_id AND plan_calculations.pid = today.plan_to_calculate?
Here is an example of my query:
UPDATE costs, today, plans INNER JOIN plan_calculations ON plans.plan_id = plan_calculations.plan_id
SET plan_calculations.plan_wks = DateDiff("ww",[start_date],[end_date]), plan_calculations.cur_yr_wks = DateDiff("ww",[start_date],"12-31"), plan_calculations.next_yr_wks = DateDiff("ww","12-31",[end_date]), plan_calculations.f1visits = [3xwks]*3, plan_calculations.f2visits = [2xwks]*2, plan_calculations.f3visits = [1xwks]*1,
WHERE (((costs.cost_id)=[costid]) AND ((plan_calculations.plan_id)=[plan_to_calculate]));
I figure it has something to do with my joins, but I can't figure out what.
Can someone please help me make this work?
Thanks.
Does this not update fields in the plan_calculations table as long as the plan_calculations.costid = costs.cost_id AND plan_calculations.pid = today.plan_to_calculate?
Here is an example of my query:
UPDATE costs, today, plans INNER JOIN plan_calculations ON plans.plan_id = plan_calculations.plan_id
SET plan_calculations.plan_wks = DateDiff("ww",[start_date],[end_date]), plan_calculations.cur_yr_wks = DateDiff("ww",[start_date],"12-31"), plan_calculations.next_yr_wks = DateDiff("ww","12-31",[end_date]), plan_calculations.f1visits = [3xwks]*3, plan_calculations.f2visits = [2xwks]*2, plan_calculations.f3visits = [1xwks]*1,
WHERE (((costs.cost_id)=[costid]) AND ((plan_calculations.plan_id)=[plan_to_calculate]));
I figure it has something to do with my joins, but I can't figure out what.
Can someone please help me make this work?
Thanks.