access update query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • arvarunar
    New Member
    • Nov 2009
    • 5

    access update query

    I have two tables:

    TrendMaster: EmployeeID, Joined_Period, Delay, Index, Branch, K

    *Joined_period takes month eg: "April", "March"...

    TrendSheet: Branch, April_Joined, April_Delay, April_Index, May_Joined...so on till March_Delay, March_Index

    I need to update April_Index with: Average of K factor of employees in TrendMaster for whome Joined_period is April-09 and these need to be grouped as TrendMaster.Bra nch=TrendSheet. Branch

    This query works if i have Ahmedabad in TrendMaster. If I dont have it, this does not update 0. I want it to update 0 if there is no record found. Please Suggest

    UPDATE TrendSheet INNER JOIN TrendMaster ON TrendSheet.Bran ch=TrendMaster. Branch SET April_Index = NZ(DAvg("[K]","TrendMaster" ,"[Joined_Period]='April-09' AND [Branch]='Ahmedabad'"), 0)
    WHERE TrendSheet.Bran ch='Ahmedabad';
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    An INNER JOIN is going to update only those records WHERE TrendShet.Branc h = 'Ahmedabad', and TrendSheet.Bran ch = TrendMaster.Bra nch. Perhaps you want a different type of JOIN?

    Comment

    • arvarunar
      New Member
      • Nov 2009
      • 5

      #3
      thanx! Left Outer Join works

      Comment

      Working...