SQL Delete 语句中使用子查询技巧
"delete d,r,p from ((select "1")tab)left join doctor d on d.id=1\nleft join registration r on d.id=r.doctor_id\nleft join posts p on d.id=p.doctor_id;
\n把这个((select "1"))加到上面的sql语句内容:可以将((select "1"))作为子查询嵌入到原有的SQL语句中,如下所示:
\nsql\n\ndelete d,r,p from (\n select \"1\"\n from tab\n) as subquery\nleft join doctor d on d.id=1\nleft join registration r on d.id=r.doctor_id\nleft join posts p on d.id=p.doctor_id;\n\n\n注意,这里使用了别名 subquery 来表示子查询的结果,并将其作为左连接的基础表。
原文地址: https://www.cveoy.top/t/topic/qd3I 著作权归作者所有。请勿转载和采集!