pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: lynch@lscorp.com
To: pgsql-sql@postgresql.org
Subject: Search Matching
Date: Mon, 4 May 1998 15:03:20 -0500
Message-ID: <v02140b44b1737f06e6d5@[207.152.64.133]> (raw)

Is there some easy way to:

1.  Match multiple fields with the same key

select * from table where * ~* 'key';

2.  Get a count of the number of matches:

EG:

table:
First     | Last
--------------------
John      | Doe
Jane      | Doe
John      | Johnson

I need a query that given 'John' and 'Doe' would return something like:

Score  | First   | Last
-----------------------
2      | John    | Doe
2      | John    | Johnson
1      | Jane    | Doe

I guess I want a search engine just like the big boys, but I don't want to
get too carried away with coding it up in PHP if there's some SQL that will
do it faster/better.  :-)

--
--
-- "TANSTAAFL" Rich lynch@lscorp.com





Message-ID: <v02140b44b1737f06e6d5@[207.152.64.133]>
Permalink:  ../v02140b44b1737f06e6d5@%5B207.152.64.133%5D/
Also on:    postgresql.org/message-id/v02140b44b1737f06e6d5@[207.152.64.133]

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: lynch@lscorp.com
  Subject: Re: Search Matching
  In-Reply-To: <v02140b44b1737f06e6d5@[207.152.64.133]>
  References: <v02140b44b1737f06e6d5@[207.152.64.133]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox