Malformed Update Statement

  • Need to fix this malformed update statement but not sure how to fix it.

    UPDATE DCR

    SET FG_AZ = (SELECT FG_AZ FROM FG fg WHERE fg.CustomerID = DR.Customer),

         FG_ty = (SELECT FG_ty FROM FG fg WHERE fg.CustomerID = DR.Customer)

    If no match if found in either matches, it should put zero in for the FG_AZ and FG_ty fields

    I also tried

     
    =Iif(Fields!FeeGoal_AZ.Value = 0,True,False)    !=    True
  • UPDATE DCR

    SET FG_AZ=ISNULL(FG.FG_AZ,0)

    ,FG_ty = ISNULL(FG.FG_ty,0)

    from DCR

    LEFT JOIN FG

    ON fg.CustomerID = DR.Customer

     

     

  • Thanks, the ISNULL worked!!

  • If you want to restrict for 0 valued records for Both AZ and FG_ty

    UPDATE DCR SET FG_AZ=FG.FG_AZ

      ,FG_ty = FG.FG_ty

    FROM DCR

      INNER JOIN FG ON DCR.Customer = FG.CustomerID

    WHERE FG.FG_AZ IS NOT NULL AND FG.FG_ty IS NOT NULL

    Andy

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply