Re: Problems with a subquery
well, i solved the issue by rewriting the query slightly differently,
as follows
SELECT id FROM users WHERE id IN ( SELECT DISTINCT t1.connected_id
FROM connections as t1 WHERE ( t1.connectee_id = 1 ) )
UNION
SELECT id FROM users WHERE id IN ( SELECT DISTINCT t2.connected_id
FROM connections as t1, connections as t2 WHERE ( t1.connectee_id =
1 ) AND ( t1.connected_id = t2.connectee_id ) );
i just can't figure out why the original query does not work.
|