select and join

  • i got a piecec of code from 3rd party app, which looks like:

    select *

    from table_1 a

    join table_2 b on a.id=b.id,

    table_3 as [some other name 1 ],

    table_4 as [some other name 2]

    what's statament about table_3 and table_4 means in this query?

    _______________________________________________________________

  • It creates a CROSS JOIN.

    These should be equivalent:

    SELECT *

    FROM table_1 a

    JOIN table_2 b ON a.id = b.id,

    table_3 AS [some other name 1 ],

    table_4 AS [some other name 2]

    SELECT *

    FROM table_1 a

    JOIN table_2 b ON a.id = b.id

    CROSS JOIN table_3 AS [some other name 1 ]

    CROSS JOIN table_4 AS [some other name 2]

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • thx!

    _______________________________________________________________

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply