-
What comes to mind would be to have your script write out the query to do pure comparisons, which return booleans, and just add up the matches.
In other words, taking your example, I'd make the query like:
SELECT rowID, a, b, c, d, e FROM
(SELECT rowID, a, a='hello' AS amatch, b, b='world' AS bmatch, c, c='tell' AS cmatch, d, d='me' AS dmatch, e, e='something' AS ematch FROM mytable) AS subquery
WHERE amatch+bmatch+cmatch+dmatch+ematch >= 3;
That should return any rows that match 3 or more out of the five. Much faster than going through the result set iteratively afterward.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|