沙滩星空的博客沙滩星空的博客

PostgreSQL以join的另一张关联表为where条件,delete删除当前表数据

Mysql

delete t1 from table1 as t1
left join table2 as t2 on t1.key = t2.key
where t2."name" = 'val' 

PostgreSQL

PostgreSQL不支持 Delete join 语句,但支持delete中using 子句提供类似功能:

delete from public.ods_cwr_end_url_request_nd ur
using public.ods_cwr_end_sites_nd st
where st."name" = 'hema' and st.id = ur.site_id

PostgreSQL Update join 和 Delete join 教程 https://blog.csdn.net/neweastsun/article/details/120068948

未经允许不得转载:沙滩星空的博客 » PostgreSQL以join的另一张关联表为where条件,delete删除当前表数据

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址