"SELECT *,
MATCH(md.keywords) AGAINST('$meta[keywords]') AS score
FROM
meta_data AS md
INNER JOIN
sites AS si ON md.domain = si.domain
WHERE
MATCH(md.keywords) AGAINST('$meta[keywords]')
ORDER BY score DESC
LIMIT 25"
我生成此查询以使用全文关键字搜索查找最佳匹配结果。现在我想通过大多数查看的条目再次对这些结果进行排序。视图也存储在站点(si.views)中的mysql数据库中。
如何通过最佳匹配分数对结果进行排序,然后按视图对这25个最佳结果进行排序?我认为这将以分组方式完成,但我不知道如何使其工作。帮助将不胜感激。谢谢,
答案 0 :(得分:1)
select * from
(
SELECT *,
MATCH(md.keywords) AGAINST('$meta[keywords]') AS score
FROM
meta_data AS md
INNER JOIN
sites AS si ON md.domain = si.domain
WHERE
MATCH(md.keywords) AGAINST('$meta[keywords]')
ORDER BY score DESC
LIMIT 25
) x
order by x.views