我只是尝试以下查询:
SELECT *,
(
SELECT count(*)
FROM users
where users.email=calls.email
) as ureg,
(
SELECT sum(qty)
FROM product
where product.owner in
(SELECT *
from users
where users.email=calls.email)
) as pop
FROM calls
order by calls.data desc
LIMIT 0,20
但我收到以下错误:
#1241 - Operand should contain 1 column(s)
我应该如何修复我的查询?
编辑:通过更改
SELECT * from users where users.email=calls.email
为
SELECT id from users where users.email=calls.email
id
它之所以有效,是因为查询在用户中存在的一堆 s 中搜索 product.owner