2014-09-19 173 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" ;