You must Sign In to post a response.
  • Category: SQL Server

    INNER JOIN vs WHERE

    What is the difference between Inner Join and where clause.
    It is just personal choice to use either or is one benifits over other.

    Please reply
  • #335715
    Hi friend,



    It's very simple, Any type of join, join two or more then two tables but where condition can't join table.
    same for inner Join also.

    Regards
    Rajesh Ranjan

  • #335717
    As far as I know both of the following queries will producr same result:-


    SELECT tb1.a,tb1.b,tb2.c
    FROM tb1, tb2
    WHERE tb1.a=tb2.a

    SELECT tb1.a,tb1.b,tb2.c
    FROM tb1
    INNER JOINE tb2
    ON tb1.a=tb2.a

    that means same task can be done by INNER JOIN and WHERE

    thats why i want to know the difference.

  • #335723
    Hi Preet,

    Inner Join is Entirely different from WHERE clause..

    Inner Join is Used to Extract the Data's from 1 or more tables Where as WHERE clause is a conditional Statement...

    For (Eg)

    Select * From Table1
    Inner Join Table2 On Table1.Field = Table2.Field
    Where TAble1.Field = Contional Statement.

    Here Inner Join Used to Extract data's from 2 Tables but where condition is used to extract the particular record which satisfies the condition.

    Hope U got...

    Regards,
    SureshB

  • #335732
    Hi,

    Both are having same functionality. No performance difference for INNER JOIN.

    Advantage of using Inner Join is: clarity and ease of understanding, also it is standard SQL

    Only difference is synatx of using

    Hope it Helps!

    Thanks and Regards,
    Babu Akkandi

  • #335803
    Hi,
    No performance difference btwn both
    advantage for join: clarity and ease of understanding, also it is standard sql

    no performance difference for INNER JOIN

  • #335914
    where this discuusion is going,

    select * from a,b
    where a.id = b.id

    or

    select * from a
    inner join b on b.id = a.id

    both are syntax of inner join, first one is ansi standard for writting inner join
    second one is T-sql standard

    then how there can be any difference between execution of both

    the only differnce is that while using ansi standard join you can't tell which type of value lookup is used for that join suppose
    you want matching value trough nested loop then you can define it in t-sql standard join
    as

    select * from a
    inner loop join b on b.id = a.id

    that's what i know, if i am wrong, please correct me

    Many Thanks
    Tejinder Singh Barnala
    /*I have the simplest tastes. I am always satisfied with the best*/


This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.