[sql] Improved the join construction and made it slightly more understandable
[sql] Improved the join construction and made it slightly more understandable

jell0720/cubes,zejn/cubes,noyeitan/cubes,cesarmarinhorj/cubes,pombredanne/cubes,ubreddy/cubes,zejn/cubes,ubreddy/cubes,jell0720/cubes,jell0720/cubes,zejn/cubes,pombredanne/cubes,noyeitan/cubes,pombredanne/cubes,noyeitan/cubes,cesarmarinhorj/cubes,ubreddy/cubes,cesarmarinhorj/cubes