Tricky SQL Question

From: Larry Pettit <larry.pettit_at_ps.net>
Date: 2000/02/03
Message-ID: <v5pm4.540$SO4.7443_at_news.uswest.net>#1/1


Given the following table/columns;

 product_number keyword
----------------------- ------------

  1                             bat
  1                             wood
  1                             large
   2                            bat
   2                            metal

I want to do a lookup where I get a match based on the number of words entered. For example I know that a self join, or subquerry would work but I would have to add a level or table for each keyword. For example;

 select t1.product
 from product_lookup t1,

          product_lookup t2

 where t1.keyword = 'wood' and
       t2.keyword = 'bat' and
       t1.product = t2.product

 PRODUCT


       1

Anybody have a solution that works recursively for any number of keywords?

Thanks Received on Thu Feb 03 2000 - 00:00:00 CET

Original text of this message