difference between given queary and among them which one is best in respect of perforamnce.

  • Hi All,

    I have a two query

    1) select * from customer inner join orderrs on customer.customerId=orders.CustomerId

    2) select * from customer orderrs where customer.customerId=orders.CustomerId

    Please tell me in detail what is diffrence between query 1 and 2 and

    which one is best for performance .

    thanks in advance.

  • From a performance perspective... they are the same. Have a look at the query plans, and you will see that they should be the same.

    The second type query has been deprecated in SQL Server 2000, so it will not be supported in a future release of SQL Server... instead you will have to use the INNER JOIN syntax as in your first query

  • Just to add to what Ian is saying, T-SQL supports two join syntaxes, SQL-89(with comma) and SQL-92(ANSI-SQL-92 compliant) (Inner Join). I think both of them are supported in SQL SRVR 2000 and SQL - 89 is deprecated in SS2k5. Performance wise I dont see any difference.

    ---------------------------------------------------------------------------------

  • You have already received the eplication ...

    I would always prefer the JOIN syntax, because that has the nicest separation of Join predicate(s) and Where caulse conditions.

    So these JOIN syntaxed queries are way easier to analyse and optimize.

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply