Let's look at the very basic join, which is INNER or EQUI JOIN
SELECT E.*
FROM HRDETAILS.EMP E
INNER JOIN HRDETAILS.EMP M
ON E.MGRID = M.EMPID;
The above query is based on ANSI joins. Now let's rewrite this query using a WHERE clause–based join syntax.
It's very simple just replace "INNER JOIN" with "," and then where ever you have ON condition replace that with either WHERE or AND condition depending on the conditions and joins in your query.
SELECT E.*
FROM HRDETAILS.EMP E ,
HRDETAILS.EMP M
WHERE E.MGRID = M.EMPID;
There will not be any difference in the out put.
Sunday, July 27, 2008
INNER JOIN in SQL Sever
Labels:
Joins,
SQL Database,
SQL Server Tips,
Vijaya Kadiyala
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment