Received: from bugs.unl.edu.ar (bugs.unl.edu.ar [168.96.132.208]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5CIr3E20017; Tue, 12 Jun 2001 14:53:04 -0400 (EDT) (envelope-from martin@bugs.unl.edu.ar) Received: by bugs.unl.edu.ar (Postfix, from userid 1004) id 578162AB4D; Tue, 12 Jun 2001 15:53:24 +0300 (GMT) Content-Type: text/plain; charset="iso-8859-1" From: =?iso-8859-1?q?Mart=EDn=20Marqu=E9s?= To: David Olbersen Subject: Re: [SQL] ORDER BY what? Date: Tue, 12 Jun 2001 15:53:22 +0300 X-Mailer: KMail [version 1.2] Cc: pgsql sql Mailing List , References: In-Reply-To: MIME-Version: 1.0 Message-Id: <01061215532200.04895@bugs> Content-Transfer-Encoding: 8bit X-Archive-Number: 200106/431 X-Sequence-Number: 10870 On Mar 12 Jun 2001 02:23, David Olbersen wrote: > On Mon, 11 Jun 2001, Martín Marqués wrote: > > My question is: "How can I write an ORDER BY statment so that it's > > ordered by the amount of matches it gets?" > > Your question is a bit unclear, what is "it"? > Specifically, what are the "it's" that are to be ordered, and which "it" > gets matches? OK, let me give an example: select * from tab1 where col1 like '%word%' or col2 like '%word%' and col3 like '%word%' and I want to order by the amopunt of matches that a matching register has. Something like, if it matches all the ORs, then it should go first, and if it matches only one of the ORs it should go last. Or maybe even have several words trying to match one of the columns. Saludos... :-) -- Cualquiera administra un NT. Ese es el problema, que cualquiera administre. ----------------------------------------------------------------- Martin Marques | mmarques@unl.edu.ar Programador, Administrador | Centro de Telematica Universidad Nacional del Litoral -----------------------------------------------------------------