Wednesday, August 10, 2011

Left Outer Join in SQL

Take an example to understand use of this:-  There are two tables. In one table VillageName column is there (which is master) and another table has VillageName and ActiveWorker columns. Now Requirement is Show the all villages where each village should show with Active Worker details if exist in table 2 otherwise show details empty with villagename.

select t1.VillageName, t2.ActiveWorker from table t1 left outer join table t2 on t1.VillageName=t2.VillageName

No comments:

Post a Comment