0

I forgot the way to write a query where you can psuedo name a table, for instance I have a table named user but I have to access it twice in one query and I want the results to be different.

something like select user(a).f_name, user(a).l_name, user(b).f_name, user(b).l_name from user(a), user(b) where user(a).id = '1' and user(b).id = '12'

Does any one know the resources to look this up?

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by NinjaMediaD
0

Just put the alias after the table name in your FROM clause and use those in place of the table name:
select a.f_name, a.l_name, b.f_name, b.l_name from user a, user b where a.id = '1' and b.id = '12'

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.