Page 2 of 2 First 12
  • Jump to page:
    #16
  1. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Sep 2006
    Posts
    2,042
    Rep Power
    535
    i don't like it
    Then I won't do it

    you start with that table, and the WHERE clause applies the filter, thus only one row is returned, and from that point on, only matching rows are joined
    I do not know the internal workings of MySQL or any other SQL engine, but maybe I should try to educate myself. Are you saying that the source code first figures out which table to deal with first (I understand that just cause I put table1 first in the query doesn't guarantee it will be run first, but go with me..), then filters the table based on the WHERE, then JOINs the next table, and filters again based on the WHERE, etc, etc?
  2. #17
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,280
    Rep Power
    4279
    Originally Posted by NotionCommotion
    Are you saying that ...
    no

    i'm saying that if you have FROM x JOIN y JOIN z WHERE z.foo=42 then it would make more sense if written FROM z JOIN y JOIN x WHERE z.foo=42

    since that's the way it's going to be executed, why not write it that way
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo