I just try following query:
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
but I get following error :
#1241 - Operand should contain 1 column(s)
How should I fix my query?
Edit:
by changing
SELECT * from users where users.email=calls.email
to
SELECT id from users where users.email=calls.email
it works because the query searches for product.owner in bunch of id
s that exist in users