Received: from issv0171.isis.de (issv0171.isis.de [195.158.131.223]) by postgresql.org (8.11.3/8.11.4) with SMTP id f95Afon80231 for ; Fri, 5 Oct 2001 06:41:51 -0400 (EDT) (envelope-from vygen@planwerk6.de) Received: (qmail 16479 invoked by uid 1010); 5 Oct 2001 10:41:45 -0000 Received: from unknown (HELO janning.planwerk6.local) ([195.158.137.29]) (envelope-sender ) by 0 (qmail-ldap-1.03) with SMTP for ; 5 Oct 2001 10:41:45 -0000 Received: from janning (localhost [127.0.0.1]) by janning.planwerk6.local (8.11.2/8.11.2/SuSE Linux 8.11.1-0.5) with SMTP id f95AdeY00995 for ; Fri, 5 Oct 2001 12:39:41 +0200 From: Janning Vygen Organization: Planwerk 6 /websolutions To: Subject: Problem with n to n relation Date: Fri, 5 Oct 2001 12:39:40 +0200 X-Mailer: KMail [version 1.1.99] Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 Message-Id: <0110051239400B.30993@janning> Content-Transfer-Encoding: 8bit X-Archive-Number: 200110/78 X-Sequence-Number: 5033 Hi, i create n to n relations like this, right? create table person ( id serial, name text ); create table address ( id serial, street text ... ); create table person2adress ( id serial, person_id integer not null references person(id), address_id integer not null references address(id), ); than i can select all adresses from one person with id =1 with select street from address where id = ( select adress_id from person2adress where person_id = 1 ); ok so far so good. but you can still insert persons without any adress. so its a 0..n relation. But how van i achieve that you canīt insert any person without adress??? thanks in advance janning