gpt4 book ai didi

php - mysql中一次删除多个表

转载 作者:行者123 更新时间:2023-11-29 06:04:44 25 4
gpt4 key购买 nike

您好,我正在尝试从单个查询中删除多个表行。

我正在尝试使用

 $query="Delete from itineraries where itineraries_id='".$_REQUEST['id']."'
Delete from itineraries_destination where itineraries_id='".$_REQUEST['id']."'
Delete from itineraries_photo where itineraries_id='".$_REQUEST['id']."'";

但是它不起作用。请推荐我。

最佳答案

尝试

Delete i, d, p
from itineraries i
inner join itineraries_destination d on d.itineraries_id = i.itineraries_id
inner join itineraries_photo p on p.itineraries_id = i.itineraries_id
where i.itineraries_id = $_REQUEST['id']

SQLFIddle

关于php - mysql中一次删除多个表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12050118/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com