If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Senior Member jf1288's Avatar
    Join Date
    Sep 2003
    Member #
    I'm using this query to select info from two tables, sessions and users, to log a user into my website.

    PHP Code:
    $sql "SELECT as name, u.status as status, u.balance as balance, u.searchus as search_us, u.searchuk as search_uk, u.searchca as search_ca, u.searchother as search_other, s.userid as userid, s.start as start, s.lastuse as last_use "
    ."FROM users as u, sessions as s "
    ."WHERE s.ip='" $ip "' AND s.sessionid='" $session "' AND u.userid = s.userid "
    Do I need to use the 'as' operator to give an alias to columns whose name is the same as the alias I'm calling it? ( as name)

    Are columns called as tableAlias.ColumnName by default, or if they are just ColumnName? ( or name by defailt)
    If its not in Family Guy its not worth it.


  3. #2
    Senior Member nsr81's Avatar
    Join Date
    Oct 2002
    Member #
    15 times
    No you don't need to use "AS" if the column name is unique within your results. u.status will show up as "status", not as "u.status"
    There and Back Again :Ogre:

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT -6. The time now is 11:39 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: