I've got the following working,
SELECT info1, info2
FROM TableA
WHERE id IN (SELECT xid
FROM TableB
WHERE userid=3 AND active=1)
which works fine, but in TableB
I also have a team
column which I'd like to select and return in the outermost select statement, something like this "pseudo" query, which of course doesn't work:
SELECT info1, info2, team
FROM TableA
WHERE id IN (SELECT xid, team
FROM TableB
WHERE userid=3 AND active=1)
I had a read around and thought maybe AS
could help but I don't really know for sure. Can anybody suggest a solution? Is this even possible?
Best Answer
This is what
JOIN
s are for: