Re: Two joins on same foreign key

From: elein <elein(at)varlena(dot)com>
To: Anony Mous <a(dot)mous(at)shaw(dot)ca>, pgsql-general(at)postgresql(dot)org
Subject: Re: Two joins on same foreign key
Date: 2004-01-31 20:16:30
Message-ID: 20040131121630.X14914@cookie.varlena.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Ooops. I've sent the wrong URL for my own darn site.
This is the correct URL.

http://www.varlena.com/GeneralBits/56.php

Sorry for the confusion.

--elein

On Sat, Jan 31, 2004 at 11:09:37AM -0800, elein wrote:
> PostgreSQL General Bits Issue #56 has an article on Join Basics
> which also has an example of multiple table joins.
>
> http://cookie.varlena.com/varlena/GeneralBits/56.php
>
> --elein
> elein(at)varlena(dot)com
>
> On Fri, Jan 30, 2004 at 03:03:35PM -0700, Anony Mous wrote:
> > Hi,
> >
> >
> >
> > I??m fairly new to this database, and have read much discussion on
> > sub-queries. I??ve seen that they can be great for some queries, and downright
> > slow for others. I have a table with two foreign keys referencing another
> > table, like:
> >
> >
> >
> > Table #1
> >
> > employee_id (pk)
> >
> > employee_name
> >
> >
> >
> > Table #2
> >
> > teamleader_employee_id
> >
> > backup_employee_id
> >
> >
> >
> > both fields in table 2 need to do a lookup in table 1 to get the name of the
> > actual employee. Do I need to use nested queries to accomplish this? Any help
> > is greatly appreciated!
> >
> >
> >
> > -AM
> >
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Russ Schneider 2004-01-31 21:56:58 Insert question null/not null serial, etc.
Previous Message Tom Lane 2004-01-31 20:13:20 Re: Large object insert/update and oid use