我有这样的查询,我理解语法不正确,但我将如何执行这样的"动作":
SELECT *
FROM accounts C
JOIN proxies P ON C.proxy_id = P.proxy_id
WHERE C.account_id NOT IN
(SELECT send,
receive
FROM action
WHERE send = C.account_id
AND receive = ".UID.") LIMIT 1
Run Code Online (Sandbox Code Playgroud)
我显示以下错误,Operand should contain 1 column(s)因为我知道我不应该NOT IN使用2列,所以我将如何进行这样的查询?
另一个解决方案是使用NOT EXISTS
WHERE NOT EXISTS
(select null
from action
where
(send = c.account_id or receive = c.account_id)
and receive = '.UID.')
LIMIT 1
Run Code Online (Sandbox Code Playgroud)
仅供参考,你可以在NOT IN中有两个值,但它们必须在两侧.
where (x, y) not in (select (a, b) from t)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
120 次 |
| 最近记录: |