So, I tried this, as suggested:
Code:
SELECT *
FROM `items`
WHERE `description` LIKE 'quick'
AND (
`description` LIKE 'brown'
OR `description` LIKE 'fox'
OR `description` LIKE 'lazy'
OR `description` LIKE 'dog'
)
LIMIT 0 , 30
ORDER BY (
(
CASE WHEN `description` LIKE 'brown'
THEN 1
ELSE 0
END
) + (
CASE WHEN `description` LIKE 'fox'
THEN 1
ELSE 0
END
) + (
CASE WHEN `description` LIKE 'lazy'
THEN 1
ELSE 0
END
) + (
CASE WHEN `description` LIKE 'dog'
THEN 1
ELSE 0
END
)
) DESC
LIMIT 0, 30
...and wound up with this:

Originally Posted by
phpMyAdmin
#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY ((CASE WHEN `description` LIKE 'brown'
THEN 1
ELSE 0
EN
I got the same error with or without the parentheses, and I think I prefer them there for clarity, so that's why they're there. Thanks again.
Bookmarks