此查询中 WHERE 的顺序是错误的,但现在是正确的。
postModel = list(PostModel.objects.raw(
SELECT max(pub_date),
count(topic_id) AS freq,
count(DISTINCT author) AS contributors
FROM crudapp_postmodel
WHERE author = "art"
GROUP BY topic_id
ORDER BY pub_date DESC
))
谢谢