Re: Two Tables That Share Data?

From: Michael Wood <esiotrot(at)gmail(dot)com>
To: Carlos Mennens <carlos(dot)mennens(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Two Tables That Share Data?
Date: 2012-02-09 16:28:41
Message-ID: CAP6d-HUGVp0pVaC26axqKLx1wRdX4m-187B-MeuZ6ZQVqbLLUA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 9 February 2012 17:33, Carlos Mennens <carlos(dot)mennens(at)gmail(dot)com> wrote:
> OK I have my 'employees.dept' field type set to INTEGER but I'm still
> trying to understand how I can perform a SQL statement that will allow
> me to query the 'employees' table and visibly see employees.manager =
> 'Phill Collins' rather than it's assigned numerical INTEGER. Below are
> both tables described:

Try something like this:

SELECT e.fname AS emp_fname, e.lname AS emp_lname, m.name AS manager
FROM employees AS e
INNER JOIN managers AS m ON e.manager = m.id
WHERE e.salary = 12345.67;

--
Michael Wood <esiotrot(at)gmail(dot)com>

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Carlos Mennens 2012-02-09 16:34:28 Re: Two Tables That Share Data?
Previous Message Oliveiros d'Azevedo Cristina 2012-02-09 15:37:40 Re: Conditional expresion in query