Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
删除表行的典型查询通常是这样的,对吧?
$query1 = odbc_exec($conn, "DELETE FROM table1 WHERE uname1 <> uname2");
但是如果我想要它在uname2不同的表中呢?
uname2
DELETE FROM table1 WHERE uname1 NOT IN ( SELECT uname2 FROM table2 )
如果uname1是唯一的,您可以执行以下操作:
uname1
DELETE FROM table1 AS t1 WHERE uname1 NOT IN ( SELECT uname2 FROM table2 AS t2 WHERE t2.uname1 = t1.uname1 );