Mysql 在连接多个表的SQL Delete上,所有表都会受到影响吗?

Mysql 在连接多个表的SQL Delete上,所有表都会受到影响吗?,mysql,sql-delete,Mysql,Sql Delete,我想连接几个表,但我只想删除表中的行 线程读取表。我得到了下面的SQL,它显示了我要删除的行 SELECT * FROM threadsread tr, threads t WHERE tr.tid=t.tid and tr.uid=2111 and t.fid=30 其中指出: *对于多表语法,DELETE从每个tbl_名称中删除满足条件的行* 如果删除上面的select,线程表也会受到影响吗 DELETE FROM threadsread tr, threads t WHERE tr.

我想连接几个表,但我只想删除表中的行 线程读取表。我得到了下面的SQL,它显示了我要删除的行

SELECT * FROM threadsread tr, threads t WHERE 
tr.tid=t.tid and tr.uid=2111 and t.fid=30
其中指出: *对于多表语法,DELETE从每个tbl_名称中删除满足条件的行*

如果删除上面的select,线程表也会受到影响吗

DELETE FROM threadsread tr, threads t 
WHERE tr.tid=t.tid and tr.uid=2111 and t.fid=30

如果会的话,我如何才能只让threadsread表受到影响?

在许多可能是大多数或所有SQL风格中,您提供的delete语句实际上是无效的。而是使用:

DELETE FROM threadsread tr, threads t 
WHERE tr.tid=t.tid and tr.uid=2111 and t.fid=30
DELETE FROM threadsread tr
USING threads t
WHERE tr.tid=t.tid AND tr.uid=2111 AND t.fid=30;

这表明您只从'from'子句中指定的一个表中删除。

我得到的sql为:DELETE from threads读取tr使用线程t,其中tr.tid=t.tid和tr.uid在2111、2564、2326、2510和t.fid=30中,我去掉了前缀。我在MULTI-DELETE中得到了一个1109未知的表'mybb_threadsread',我试着不使用本文中提到的别名:使用mybb_threads t从mybb_threadsread删除,其中mybb_threadsread.tid=mybb_threads.tid和mybb_threadsread.uid在211125642326中,2510和mybb_threads.fid=30,但我仍然得到完全相同的消息……听起来好像“mybb_threadsread”不是一个表。我最好的猜测是:它是一个打字错误,或者它不是一个表,而是一个视图,或者其他类似于表的对象。我不知道如果你试图从一个视图中删除MySQL是否会这样做。不,这既不是视图,也不是打字错误。它适用于select命令。。。我在这里得到的一些信息: