Given the following tables:
tableA(v1,v2)
tableB(v3,v4)
tableC(v5,v6)
I want to write a query like the following one:
SELECT MAX(v1)
FROM tableA
WHERE v2 IN (SELECT v3
FROM tableB
WHERE v4 IN (SELECT v5
FROM tableC
)
)
GROUP BY v6
Is something like this possible only by using IN?? I know how to write it by using JOINs between my three tables but I don’t want to use JOINs.
No, it’s not possible to do this without using
JOIN(at least in MS-SQL).http://msdn.microsoft.com/en-us/library/ms177673.aspx