Results 1 to 5 of 5

Thread: Inner Join V/s Left Join

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2006
    Posts
    977

    Inner Join V/s Left Join

    Hi

    I want to know the difference between the use of Inner Join and Left Join in a SQL Statement

    thanks

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Inner Join V/s Left Join

    You can read the FAQ - it should be in there

    Inner Join:
    Bring only records that exist in both the left table and right table.

    Left join:
    Bring all records in the left table and only those that match from the right table. (uses null for those none matched)

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3
    Addicted Member
    Join Date
    May 2001
    Location
    Montréal, Québec
    Posts
    195

    Re: Inner Join V/s Left Join

    There's also good examples on wikipedia on all type of joins

    http://en.wikipedia.org/wiki/Join_(SQL)

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Inner Join V/s Left Join

    This might be worth taking a look at.

  5. #5
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Inner Join V/s Left Join

    Real world...

    We use LEFT JOIN 99% of the time.

    Although referential integrity should allow INNER JOIN since both sides should almost always exist, since we have legacy data converted from mainframes we would not want to lose the "FROM" table data simply because the "LEFT JOIN" table does not offer up a matching row.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width