Left join - DotNet and DataBase

Wednesday, 1 August 2018

Left join



LEFT JOIN/LEFT OUTER JOIN
LEFT JOIN is used to retrieve data from two or more tables by comparing common fields.
LEFT JOIN and LEFT OUTER JOIN both are the same in functionality.
LEFT JOIN Query returns all rows from LEFT tables and matching rows only from the RIGHT table.
Not matching rows from the RIGHT table are return with the NULL value.

Syntax:
SELECT column_name(s)
FROM table1
LEFT [Outer] JOIN table2
ON table1.column_name=table2.column_name;

Example:
SELECT E.EmpID,E.EmpName,D.Department FROM tbl_Employees E
LEFT JOIN tbl_Dept D ON
E.DeptID = D.DeptID

Result
Left_join

No comments:

Post a Comment

x

Get Updates On

Discussion updates

Straight Into Your INBOX!

Enter your email address to subscribe to this website and receive notifications of new posts by email.