SHARE
TWEET

Untitled

a guest Jan 4th, 2013 21 Never
  1. 1.
  2.  MERGE tbl AS target
  3. USING tb2  AS source
  4. ON (target.id = source.id)
  5.  
  6. WHEN MATCHED and source.price >450
  7. then  
  8. UPDATE SET TARGET.price = SOURCE.price,
  9. TARGET.group = SOURCE.group
  10.  
  11.  2.
  12.  update tb1
  13. set
  14. tb1.price=tb2.price,
  15. tb1.group=tb2.group from tb2
  16. left join tb1 on tb1.id =tb2.id
  17. where tb1.id =tb2.id
  18. and tb1.price>450
RAW Paste Data
Top