Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (20.3k points)

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.

I have tried this:

DELETE s FROM spawnlist s

INNER JOIN npc n ON s.npc_templateid = n.idTemplate

WHERE (n.type = "monster");

1 Answer

0 votes
by (40.7k points)

Try adding .* to s in your first line of code like this:

DELETE s.* FROM spawnlist s

INNER JOIN npc n ON s.npc_templateid = n.idTemplate

WHERE (n.type = "monster");

Related questions

+3 votes
1 answer
asked Jul 3, 2019 in SQL by Tech4ever (20.3k points)
+2 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...