Search Matching

From: lynch(at)lscorp(dot)com (Richard Lynch)
To: pgsql-sql(at)postgresql(dot)org
Subject: Search Matching
Date: 1998-05-04 20:03:20
Message-ID: v02140b44b1737f06e6d5@[207.152.64.133]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)lscorp(dot)com

Browse pgsql-sql by date

  From Date Subject
Next Message Roland B. Roberts 1998-05-05 00:18:03 subscribe
Previous Message Mario Filipe 1998-05-04 09:33:45