• vinodpec (4/28/2010)


    Please explain different between the queries

    SELECT *

    FROM EmpAddress addr

    LEFT JOIN EmpEducation edu

    ON addr.empid = edu.empid

    --WHERE EDU.EMPID IS NULL

    WHERE addr. AddType = 2

    SELECT *

    FROM EmpAddress addr

    LEFT JOIN EmpEducation edu

    ON addr.empid = edu.empid AND addr. AddType =

    the 1st query will show only results where from empaddress where addtype=2 - it will then join edu table and show those fields as well (but will not use this to limit rows returned)

    the second query will will show all records from empaddress regardless off addtype and will then join edu table and show any related data - again it will not be used to filter the record set

    query 1 will return less records

    query 2 will have more blank data in the columns for edu table where the addr table <>2

    MVDBA