有没有办法删除此特定列? 这不起作用。 虽然,SELECT在mysql中运行良好,但已经过测试。
DELETE FROM table2
WHERE table2.ID IN (SELECT * FROM table2, table1
WHERE table2.tableID = 2 and table1.level = 1 and table1.ID = 1)
要添加,table1和table2具有列:
table1(table1.id, table1.name, table1.level)
table2(table2.id, table1.id)
我有两张桌子:
用户
userid username userleve
1 dani 1
2 mark 2
游戏
gameid userid cluba clubb resa resb
1 1 liverpool chealsea 1 1
2 2 Aston Villa Watford 0 0
3 1 Sunderland Swansea City 2 1
表之间没有FK,我需要删除输入的1行 特定级别的特定用户。
答案 0 :(得分:0)
试试这个:
DELETE FROM games
USING games
JOIN users ON games.userid = users.userid
WHERE games.userID = 2
and users.userlevel = 1;
select * from users;
select * from games;