Last active
December 30, 2015 08:09
-
-
Save sudarsang/7800331 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH R1 AS | |
(SELECT * FROM A JOIN B ON A.X = B.Y WHERE A.Z = 'abcd' | |
) , | |
R2 AS | |
(SELECT * FROM C WHERE D.X = 'pqrs' AND D.Y IN (SELECT Y FROM R1) | |
) , | |
R3 AS | |
(SELECT * FROM E JOIN R2 ON E.X = R2.Y WHERE E.Z = 'pqrs' AND R2.P ='bla bla' | |
) | |
SELECT R3.somthing, | |
tab.something | |
FROM R3, | |
anotherTable tab | |
WHERE THIS= 'THAT' | |
ORDER BY R3.P |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment