SELECT from two tables with different field names?

From: Pandu Poluan <pandu(at)poluan(dot)info>
To: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: SELECT from two tables with different field names?
Date: 2011-12-12 04:39:19
Message-ID: CAA2qdGXO+GdTheYeu2a_ZNgXCozuA=SvhyiZVLDSYxuuxD_dgQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hello!

Due to some legacy apps, I end up with two tables with similar information,
but with zero intersection (i.e., both tables are exclusive of each other).

For illustration:

table_one has the fields emp_id and fullname

table_two has the fields employee_id, first_name, and last_name

Now, I need a query that will search for employee ID in both tables and
return his/her full name.

How do I do that? Will a simple UNION suffice?

Rgds,

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Thomas Kellerer 2011-12-12 08:25:06 Re: SELECT from two tables with different field names?
Previous Message Jean-Yves F. Barbier 2011-12-09 08:33:31 Re: taking a sparse slice of an array