Jordan Davis Jordan Davis - 9 months ago 57
SQL Question

select statement within select

I have a

column in my
table which contains a string
, these numbers reference the
's that the user "manages" .


SELECT * FROM user WHERE id IN(SELECT manage FROM user WHERE id = 1)

Question: Why is my statement returning nothing?


You could create a new table user_manages, which contains two columns: manager_id and user_id. Create a new record in the table for each user a manager manages. Then you could develop a join between the two tables.

SELECT user.* FROM user_manages
INNER JOIN user ON = user_manages.user_id
WHERE user_manages.manager_id = 1