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
280 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
MS SQL Bulk load data error 5 34
SQL Server RDS clr assembly 4 37
t-sql month question 8 43
Stored procedure 23 23
Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
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 different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to shrink a transaction log file down to a reasonable size.

759 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now