使用INNER JOIN删除SQL [英] SQL DELETE with INNER JOIN
本文介绍了使用INNER JOIN删除SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有2个表,spawnlist
和npc
,我需要从spawnlsit
中删除数据.
npc_templateid = n.idTemplate
是唯一连接"表的东西.
我已经尝试过此脚本,但是它不起作用.
There are 2 tables, spawnlist
and npc
, and I need to delete data from spawnlsit
.
npc_templateid = n.idTemplate
is the only thing that "connect" the tables.
I have tried this script but it doesn't work.
我已经尝试过了:
DELETE s FROM spawnlist s
INNER JOIN npc n ON s.npc_templateid = n.idTemplate
WHERE (n.type = "monster");
推荐答案
在第一行中将.*
添加到s
.
Add .*
to s
in your first line.
尝试:
DELETE s.* FROM spawnlist s
INNER JOIN npc n ON s.npc_templateid = n.idTemplate
WHERE (n.type = "monster");
这篇关于使用INNER JOIN删除SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文