如何按qid排序显示此查询?
$newcount=$db->get_results("
SELECT s2.qcategory,
s1.id,
count(s1.na) as na_count
FROM (
select distinct `qcategory`
from store
where survey_name='$userID' and
dateone='$dateVal' and
branch='$branch'
) s2
left join store s1
on s1.`qcategory` = s2.`qcategory` and
s1.`na` = '1'
group by 1
order by s1.qid");
答案 0 :(得分:1)
试试这个
ORDER BY s1.qid ASC
或
ORDER BY s1.qid DESC
以及为什么要制作GROUP BY 1
??
答案 1 :(得分:0)