SQL question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alex79
    Confirmed User
    • Jun 2002
    • 996

    #1

    SQL question

    What is the difference between

    Code:
    Select * from tablea a join tableb b on a.id=b.id
            where id=100
    and

    Code:
    Select * from tablea a join tableb b on a.id=b.id and a.id=100
    Is the second sintax faster? in first case the script will realise the join after all rows from tablea and after the join is complete will filter after the id=100 and is second case the join will be realised only after the row where id=100? (if yes then second case i think is much faster)

    any opinions?
  • woj
    <&(©¿©)&>
    • Jul 2002
    • 47882

    #2
    Your best bet is to just make up some tables, and test it real quick...
    Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
    Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
    Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager

    Comment

    • pstation
      Confirmed User
      • Jul 2003
      • 1135

      #3
      They're essentially the same, if you're using MySQL you can prepend the query with "EXPLAIN" to view more information about the query.

      Comment

      Working...