我从以下查询中收到以下错误,因为我试图通过在查询本身中检索到的值对结果进行排序。请你告诉我如何解决这个错误,我猜是通过在查询中创建一个子查询,我不知道怎么做!
SELECT q.*, COUNT(DISTINCT a.qid) AS `a_count`
FROM `questions` AS q
INNER JOIN `answers` AS a
ON a.qid = q.id
ORDER BY MAX(a_count)
LIMIT 0, 10;
我从以下查询中收到以下错误,因为我试图通过在查询本身中检索到的值对结果进行排序。请你告诉我如何解决这个错误,我猜是通过在查询中创建一个子查询,我不知道怎么做!
SELECT q.*, COUNT(DISTINCT a.qid) AS `a_count`
FROM `questions` AS q
INNER JOIN `answers` AS a
ON a.qid = q.id
ORDER BY MAX(a_count)
LIMIT 0, 10;