SQL question - duplicate records from join

From: "Raymond O'Donnell" <rod(at)iol(dot)ie>
To: pgsql-general(at)postgresql(dot)org
Subject: SQL question - duplicate records from join
Date: 2002-02-28 18:46:39
Message-ID: 3C7E7B0F.16439.137F870@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

I recently upgraded to Postgres 7.1 (having finally found the correct
pg_dump!), and now I notice that joins are returning duplicate
records. A typical query would be:

select i.itemcode, i.itemname, d.deptname, r.roomname
from items i
inner join departments d on (i.deptcode=d.deptcode)
inner join rooms r on (i.roomcode=r.roomcode)
where... (etc)

This query returns four copies of each record, where before I just
got one as I'd expect. Am I doing something wrong here?

Thanks for all your help.

--Ray.

--------------------------------------
Raymond O'Donnell
rod(at)iol(dot)ie
rod(at)gti(dot)ie
--------------------------------------

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dino Hoboloney 2002-02-28 18:57:17 SQL statement : list table details
Previous Message Tom Lane 2002-02-28 18:05:37 Re: Defunct postmasters