Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Srain
Starting Member
23 Posts |
Posted - 2008-09-25 : 13:16:02
|
| Hi All, Please can you tell do we see any difference between below two queries. what is the advantage of using JOIN rather putting the condition in where clause.QUERY1 -Select tab1.a, tab2.bfrom table1 tab1 JOINtable2 tab2 ON tab1.a = tab2.aQUERY2 -select tab1.a, tab2.b from table1 tab1, table2 tab2where tab1.a = tab2.a |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-25 : 13:19:40
|
quote: Originally posted by Srain Hi All, Please can you tell do we see any difference between below two queries. what is the advantage of using JOIN rather putting the condition in where clause.QUERY1 -Select tab1.a, tab2.bfrom table1 tab1 JOINtable2 tab2 ON tab1.a = tab2.aQUERY2 -select tab1.a, tab2.b from table1 tab1, table2 tab2where tab1.a = tab2.a
Both the queries are one and the same. the QUERY2 is old way of representing joins while QUERY1 uses ANSI JOIN syntax. You should try to use first syntax from now on as second syntax will be removed from the future versions of SQL Server and will cause code to break. QUERY2 syntax will work only until sql 2000. |
 |
|
|
|
|
|