• Danny Ocean (4/17/2013)


    Kapil, Cross join means Cartesian product. When query have multiple joins, it solve it from left to right. So first cross join take place between table #T1 and #T2. It gives 2 (1 *2) rows. Now these 2 rows have cross join with #T3. It gives 6 (2*3) rows. Output of this query look like below.

    id1id2id3

    111

    112

    113

    121

    122

    123

    Now calculate sum of column id3. its 1+2+3+1+2+3 = 12.

    So Total row count is 6 and total of id3 column is 12.

    I think this help you. 🙂

    Just for counting the rows or sums in cartesian cross join it does not matter if you solve multiple joins from left or from right.



    See, understand, learn, try, use efficient
    © Dr.Plch