views:

23

answers:

0

Let's say I've got two tables:

NOTES has two columns: ID and BODY. BODY is a FULLTEXT index.

KEYWORDS has two columns: ID and KEYWORD.

I want to search every BODY for every KEYWORD and get one row for each match, the NOTES.ID and the KEYWORD.ID. So if there were 15 notes and each one matched 3 keywords, I would get 45 rows.

But as far as I can see there's no way to use anything but a constant in the AGAINST() statement, so in order to do this I'd need to loop through every keyword (there are thousands) and run a query for it. Is there some way to do this comparison in only one (or a few) queries?