• kapil_kk (4/4/2013)


    Hi all,

    I also thinks that the options are not well written... Sorry for that 🙁 ..

    My point of concern was to to throw light on different behaviors of AND and WHERE clause when use with LEFT and INNER JOIN..

    --Query 1

    SELECT

    *

    FROM table1 t1

    LEFT JOIN table2 t2

    on t1.id = t2.id AND t1.flag = 1

    --Query 2

    SELECT

    *

    FROM table1 t1

    left JOIN table2 t2

    on t1.id = t2.id

    WHERE t2.flag = 1

    If you execute these queries you will get same amount of rows in case of INNER JOIN while no of rows gets different when you put LEFT JOIN in this...

    I appreciate your reply and don't worry about mistakes. It's courage to take a step, learning from mistakes and improve it for future. 🙂

    Thanks
    Vinay Kumar
    -----------------------------------------------------------------
    Keep Learning - Keep Growing !!!