Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id AB6719FB887 for ; Tue, 16 Oct 2007 14:15:09 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 48838-04 for ; Tue, 16 Oct 2007 14:14:54 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from web31810.mail.mud.yahoo.com (web31810.mail.mud.yahoo.com [68.142.207.73]) by postgresql.org (Postfix) with SMTP id B81AE9FB87D for ; Tue, 16 Oct 2007 14:15:00 -0300 (ADT) Received: (qmail 92416 invoked by uid 60001); 16 Oct 2007 17:14:59 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=57veXKQWOg5Ej6jTSBzyWtlY/xqgffnPNfw2qY7K/RxC/XcfzQnTVfBYfys4E+yKa+WcY4q8C83j50ZOmm3xjcYt/tLD5E/6SKUwxaTN9DkOWYe3JEJMaJcEyvfcbqnv/gyVkEvtV3/2A8jfjNBlb5oTdDkh69vVfvBTImjHzDg=; X-YMail-OSG: MGstCZwVM1kcTkcTbaeIaXUZUsztjnB761T6.ChKpRrFlpgH_tQIJui6ByW05yYFZg-- Received: from [12.180.237.138] by web31810.mail.mud.yahoo.com via HTTP; Tue, 16 Oct 2007 10:14:59 PDT Date: Tue, 16 Oct 2007 10:14:59 -0700 (PDT) From: Richard Broersma Jr Subject: Re: Having difficulty writing a "best-fit" query.. To: Jamie Tufnell , pgsql-sql@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <354400.92381.qm@web31810.mail.mud.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/72 X-Sequence-Number: 29444 --- Jamie Tufnell wrote: > movie_id, genre_id, relevance (i've used movie/genre titles for clarity > here, but in reality they're id's) > -------------------------------------------- > beverly hills cop, action, 2 > beverly hills cop, comedy, 1 > the heartbreak kid, comedy, 2 > the heartbreak kid, romance, 1 > First of all, if there's a better way to model this kind of ranking/ordering > of many-to-many relationships, please let me know. Joe Celko had an example like this in his book: 17: EMPLOYMENT AGENCY PUZZLE http://www.elsevier.com/wps/find/bookdescription.cws_home/710075/description#description the only difference was that he was modeling employees and skillsets. IIRC, the terminology for the improved model was the "full disjuctive" model. Regards, Richard Broersma Jr.