这是我的表
从上面
我的查询是
SELECT count_id, COUNT( questionID ) AS qid
FROM `sg_count`
GROUP BY count_id
它将获得输出
我还想使用第一次查询的结果来计算(count_id)qid <5的人
答案 0 :(得分:1)
试试这个 -
"SELECT count(qid) FROM (
SELECT count_id, COUNT( questionID ) AS qid FROM `sg_count` GROUP BY count_id
) as count_data where qid < 5" ;