这是我的桌子
从上面
我的查询是
SELECT count_id, COUNT( questionID ) AS qid
FROM `sg_count`
GROUP BY count_id
它会得到输出
我也想使用第一次查询的结果来计算qid
最佳答案
试试这个-
"SELECT count(qid) FROM (
SELECT count_id, COUNT( questionID ) AS qid FROM `sg_count` GROUP BY count_id
) as count_data where qid < 5" ;