Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2007

    Unanswered: Query speed when using aliases for tables.


    Does queries become slower when you type them like this:

    SELECT concat(U.Firstname, ' ', U.Lastname) AS 'Full Name', L.Username FROM tbusers U, tblogin L WHERE U.ID = L.UserID AND L.iActive = 1

    rather than typing them out fully like this:

    SELECT concat(tbusers.Firstname, ' ', tbusers.Lastname) AS 'Full Name', tblogin.Username FROM tbusers JOIN tblogin on tbusers.ID = tblogin.UserID WHERE tblogin.iActive = 1

    And why are there 2 ways to do the same query ?

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    1. no, there is no difference in speed, but there is a dramatic increase in understandability

    besides, you confused two questions into one: use of longer table aliases, and use of JOIN syntax

    2. actually, there are more than 2 ways to do the same query | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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