嗨,我有一个查询,它通过显示首先被评分的评论然后是尚未被评分的评论来完成我想要的操作。但是我似乎无法正确订购。
结果应该是什么样子:
5
4
0
0
...
目前它正在这样做:
4
5
0
0
...
这是我的查询
$sql = $db->query( "
SELECT branch.*, MAX(review.rating) AS m
FROM branch
LEFT OUTER JOIN review ON branch.bid = review.bid
WHERE branch.address2 LIKE '$query' OR branch.postcode LIKE '$query-%'
GROUP BY branch.bid
ORDER BY m DESC, branch.branch ASC
LIMIT $start,$limit
" ) or die( "Select failed: (" . $db->errno . ") " . $db->error );