SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    'where' clause or 'inner join' clause, which is efficient?

    Hi,

    Is it bad practice/inefficient to use a 'where' clause for inner joins? Or is it just a readability issue? Which is more efficient?

    example:

    select x, y, z
    from a inner join b on a.id = b.parent_id
    where a.x=123

    or

    select x, y, z
    from a, b
    where a.id = b.parent_id and a.x=123

    Thanks,
    John

  2. #2
    Just Blow It bronze trophy
    DaveMaxwell's Avatar
    Join Date
    Nov 1999
    Location
    Mechanicsburg, PA
    Posts
    7,294
    Mentioned
    123 Post(s)
    Tagged
    1 Thread(s)
    The inner join is slightly more efficient since the DBMS will convert the first syntax into the join anyway. But the difference is miniscule, so I would go with whichever method is easier for you to read.
    Dave Maxwell - Manage Your Site Team Leader
    My favorite YouTube Video! | Star Wars, Dr Suess Style
    Learn how to be ready for The Forums' Move to Discourse


Bookmarks

Posting Permissions

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