a guest Oct 12th, 2017 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. UPDATE dex_mfgx..insp_master
  2.   SET dex_mfgx..insp_master.costperpart = t2.sct_cst_tot
  3.   FROM dex_mfgx..insp_master AS t1
  4.   INNER JOIN qad_repl..sct_det_sql AS t2
  5.   ON t1.partnum = t2.sct_part
  6.   WHERE t1.partnum = t2.sct_part and t2.sct_cst_date = MAX(t2.sct_cst_date) ;
  8. Msg 147, Level 15, State 1, Line 6
  9. An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference.
RAW Paste Data