?
Solved

Equivalent LEFT JOIN SQL?

Posted on 2011-02-21
3
Medium Priority
?
773 Views
Last Modified: 2012-05-11
A while back I asked a question which helped me to build the following (first) SQL statement. Out of interest. Could somebody tell me if both of the following statements are identical. Is the alias just for convenience, or could it alter the output in any way?

SELECT t1.* FROM user_group_link AS t2 LEFT JOIN user AS t1 ON t2.user_id = t1.id WHERE t2.group_id=[b]INPUT[/b]

Open in new window


SELECT user.* FROM user_group_link LEFT JOIN user ON user_group_link.user_id = user.id WHERE user_group_link.group_id=[b]INPUT[/b]

Open in new window

0
Comment
Question by:numberkruncher
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
markterry earned 2000 total points
ID: 34944612
Yes, they are the same. Aliases are simply to shorten your object names in a query. This way you can give your tables descriptive names, and not have to be constantly inconvienced by the name while typing.
0
 
LVL 6

Expert Comment

by:markterry
ID: 34944635
in fact, if the colum names are unique to all tables, you do not even need the tablename.columnname, you can just put colum name. But this is not good practice.
0
 
LVL 13

Author Comment

by:numberkruncher
ID: 34944704
Thanks, I wasn't sure what the AS was giving an alias to the table name or whether it was giving a name to a set of results which had to be re-addressed.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question