View Single Post
Old 02-14-2008   #5 (permalink)
tamlin
Janitor of Lunacy
 
tamlin's Avatar
 
Join Date: May 2006
Location: Sitting in the Wishing Chair
Posts: 4,970

Quote:
Originally Posted by Telos View Post
Code:
select u.user_id from users u
You don't need to use the table alias until after you declare it.
Code:
select u.user_id from users u
would give you the same result as
Code:
select user_id from users u
but after you've declared a table alias you must use that in the rest of the query. In other words
Code:
select user_id from users u
order by u.user_id
would work, but
Code:
select user_id from users u
order by users.user_id
would give you a syntax error. (1109 - Unknown table 'users' in order clause)
__________________


Religion: It's all fun and games until someone gets burned at the stake...
tamlin is offline   Reply With Quote