1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| SELECT
Top 10
ArticleID,
ArticleTitle,
ArticleContent
FROM
Articles
ORDER BY
(CASE WHEN ArticleTitle = 'Article Title' THEN 1 ELSE 0 END) DESC,
(CASE WHEN ArticleTitle = 'Article' THEN 1 ELSE 0 END) DESC,
(CASE WHEN ArticleTitle = 'Title' THEN 1 ELSE 0 END) DESC,
(CASE WHEN Soundex('Article Title') = Soundex(ArticleTitle) THEN 1 ELSE 0 END) DESC,
(CASE WHEN Soundex('Article') = Soundex(ArticleTitle) THEN 1 ELSE 0 END) DESC,
(CASE WHEN Soundex('Title') = Soundex(ArticleTitle) THEN 1 ELSE 0 END) DESC,
(CASE WHEN PatIndex('%Article%Title%', ArticleTitle) > 0 THEN 1 ELSE 0 END) DESC,
(CASE WHEN PatIndex('%Article%', ArticleTitle) > 0 THEN 1 ELSE 0 END) DESC,
(CASE WHEN PatIndex('%Title%', ArticleTitle) > 0 THEN 1 ELSE 0 END) DESC,
(CASE WHEN PatIndex('%Article%Title%', ArticleContent) > 0 THEN 1 ELSE 0 END) DESC,
(CASE WHEN PatIndex('%Article%', ArticleContent) > 0 THEN 1 ELSE 0 END) DESC,
(CASE WHEN PatIndex('%Title%', ArticleContent) > 0 THEN 1 ELSE 0 END) DESC |