Solved

SQL - Join table a and table b on a.code = b.code Vs from table a, table b where a.code = b.code

Posted on 2012-03-15
5
285 Views
Last Modified: 2012-06-27
I am trying to understand the difference between Join table a and table b on a.code = b.code Vs from table a, table b where a.code = b.code.
Is there any difference or when will they be different?

I am using SQL Server 2008 R2
0
Comment
Question by:tommym121
5 Comments
 
LVL 29

Assisted Solution

by:Paul Jackson
Paul Jackson earned 100 total points
ID: 37725892
There is no difference.
0
 
LVL 51

Assisted Solution

by:HainKurt
HainKurt earned 100 total points
ID: 37726139
there is difference :)

select * from Join mytable1 a and mytable2 b on a.code = b.code

above is not correct syntax, gives error

select * from mytable1 a, mytable2 b where a.code = b.code

above is correct...

select * from mytable1 a inner join mytable2 b on a.code = b.code

above is also correct and same as the other one...
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 200 total points
ID: 37726163
If that is all it is, then the QO in SQL Server is smart enough to recognize the old syntax as a JOIN.  However, I would encourage you to start using the newer syntax, it is only a question of time before it is no longer supported.  There are also some edge cases where I have seen that mixing the syntax produces bad performance.
0
 

Accepted Solution

by:
gnetgnet earned 100 total points
ID: 37726257
These are the same
0
 

Author Closing Comment

by:tommym121
ID: 37729740
Thanks
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question