PostgreSQL执行update+join操作

  • 2018-08-20
  • 25
  • 0
  • 0

项目中需要按 评论表的评论周来 关联更新关系表,目前用的greenPlum与mysql语法有些不同,记录一下:

Mysql:

UPDATE scene_product_relation_xiyiji AS t1
JOIN comment_xiyiji AS t2 ON t1.comment_id = t2. ID
SET comment_week = t2.comment_week

PostgreSql:

UPDATE scene_product_relation_xiyiji AS t1
SET comment_week = t2.comment_week
FROM comment_xiyiji AS t2
WHERE t1.comment_id = t2.id

评论

还没有任何评论,你来说两句吧

发表评论