2014-09-19 159 views
0

这里是我的表产生不同于其他查询的MySQL的结果结果

enter image description here

从上面

我的查询是

SELECT count_id, COUNT(questionID) AS qid 
FROM `sg_count` 
GROUP BY count_id 

它会得到输出enter image description here

我还想要数(count_id)谁QID < 5第一次查询

+0

你可以试试你的第一次查询后过滤在PHP本身的结果。这会更容易。 – sush 2014-09-19 04:31:17

+1

您希望成为您提供的样本数据的确切输出结果? – 2014-09-19 04:31:41

+0

我想count(count_id)其中qid> 3 0r任何条件后第一个查询执行 – 2014-09-19 04:34:21

回答

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" ;