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?

Recommended Answers

All 2 Replies

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'

Thank you appreciate it!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.