Just for the sake of replicating what you were trying to do, in SQL Server
2000 you can use UDF:
CREATE FUNCTION dbo.B
( @x CHAR(1) )
RETURNS CHAR
AS
BEGIN
SET @x = (SELECT y FROM Bar WHERE x = @x
UNION
SELECT y FROM Bar WHERE x = @x)
RETURN @x
END
Then you can write the query like:
SELECT x, dbo.B(x)
FROM Foo
WHERE dbo.B(x) IS NOT NULL