Postgresql supports user-defined aggregate functions.  You don't need them very often, but it's handy when you do. :)

On 4/3/06, Qvx < [EMAIL PROTECTED]> wrote:
Stored procedure will be different for each database. I can help you with Oracle.

I would make my query like this:

SELECT doc.id, SUM( his.cnt/doc.word_count) weight
  FROM doc, his
 WHERE doc.id = his.doc_id
   AND his.word IN (:w1, :w2, :w3)
 GROUP BY doc.id
HAVING COUNT(*) = :num_search_words
 ORDER BY 2 DESC


But then again, this is not what you want. You want product and I don't know of any. For that you will have to loop and multiply yourself.

--
Jonathan Ellis
http://spyced.blogspot.com

Reply via email to