Re: Having difficulty writing a "best-fit" query.. - Mailing list pgsql-sql

From Rodrigo De León
Subject Re: Having difficulty writing a "best-fit" query..
Date
Msg-id a55915760710161011g6f67bbdege536dc3f8ac22342@mail.gmail.com
Whole thread Raw
In response to Having difficulty writing a "best-fit" query..  ("Jamie Tufnell" <diesql@googlemail.com>)
List pgsql-sql
On 10/16/07, Jamie Tufnell <diesql@googlemail.com> wrote:
> I'm taking a subset of all my genres, and I want to get ONE row for each
> movie in the subset alongside its most appropriate genre (whichever has the
> highest relevance).  In other words, the best fit.

You didn't provide the expected output, but try:

SELECT * FROM t ttWHERE relevance = (SELECT MAX(relevance)                     FROM t                    WHERE movie_id
=tt.movie_id)
 


pgsql-sql by date:

Previous
From: "Jamie Tufnell"
Date:
Subject: Having difficulty writing a "best-fit" query..
Next
From: Richard Broersma Jr
Date:
Subject: Re: Having difficulty writing a "best-fit" query..