SQL Query Help?

From: Mike Briggs <mikeb_at_probes.com>
Date: 2000/01/19
Message-ID: <38861135.77BC8119_at_probes.com>#1/1


This is probably a newbie question, but it has me stumped.

Basically, I want to build a small search engine to cover our bibliography database. Each article is linked to n keywords (usually about 12). The keywords are not prioritized or weighted in any way. The users need to be able to enter their search criteria as keywords, and I need to return the articles which best match their search criteria. Simple, right?

So, I built simple two-column table linking the unique key of each article (there are about 30,000) to each of it's keywords. Now, how do I search this table? If the user is looking for "stuff", "junk" and "nonsense", I would like to generate a result set which shows all articles matching at least one keyword, ORDERED BY THE NUMBER OF KEYWORDS MATCHED, desc.

It's the part in caps that has me stumped. Any suggestions? There's got to be some way of using a group by, and count to get this, right? Every search engine in the world has solved this, and I'm starting to feel pretty stupid, even though I've been building database applications for years. Received on Wed Jan 19 2000 - 00:00:00 CET

Original text of this message