Wednesday, March 7, 2012

join statement

when I am trying to optimize a proc, I saw one code which I don't know

select a.col1, b.col1

from tbl1 a, tbl2 b

where a.col2*=b.col2

what does this mean ( what will be the result set)

how can I write it in different way

Thanks

This is an old-style outer join which is actually deprecated in sql server 2005. Your code can be written this way

select
a.col1,
b.col2
from tbl1 a
left join tbl2 b ON a.col2 = b.col2

No comments:

Post a Comment