Danny Ocean (4/17/2013)
kapil_kk (4/17/2013)
Nice question... learn something new today.. 🙂But can anyone plz explain me about the SUM part which is returning 12, I am not clear with this section :w00t:
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. 🙂
Thanks Vinay...:-)
Its clear to me now 🙂
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/