正如标题所解释的,我想从两个不同的表中删除行。
在这种情况下,我要删除UHL_HotelId
等于cus_DVndBgfwSVaZhe
的所有用户。
___用户表
|--------|
| USR_Id |
|--------|
| 100 |
| 102 |
| 103 |
| 104 |
| 105 |
| 106 |
| 107 |
|--------|
___ UsersHotelsLink
|--------|------------|--------------------|
| UHL_Id | UHL_UserId | UHL_HotelId |
|--------|------------|--------------------|
| 1 | 100 | cus_DVndBgfwSVaZhe |
| 2 | 101 | cus_DVndBgfwSVaZhe |
| 3 | 102 | cus_DVndBgfwSVaZhe |
| 4 | 103 | cus_DVndBgfwSVaZhe |
| 5 | 104 | cus_DVndBgfwSVaZhe |
| 5 | 105 | cus_DVndBgfwSVaZhe |
| 6 | 106 | cus_GHbnGhGgu3lbnw |
| 7 | 107 | cus_GHbnGhGgu3lbnw |
|--------|------------|--------------------|
我的尝试如下:
DELETE a.*, b.*
FROM ___Users a
JOIN ___UsersHotelsLink b
ON b.UHL_UserId = a.USR_Id
WHERE a.UHL_HotelId = 'cus_DVndBgfwSVaZhe';
为什么我的查询无法正常工作?
答案 0 :(得分:0)
假定您可以使用的两个表之间具有外键关系
<div>
<div *ngIf="nolimit">
<p class="isGroup">No limit message</p>
</div>
<div *ngIf="noDelegation">
<p class="isGroup">No delegation</p>
</div>
</div>
<div *ngIf="!nolimit && !noDelegation">
Content here
</div>
“当您从父表中删除数据时,它允许您从子表中自动删除数据”