鍍金池/ 問(wèn)答/C  數(shù)據(jù)庫(kù)/ sql 統(tǒng)計(jì)來(lái)看看

sql 統(tǒng)計(jì)來(lái)看看

圖片描述

如圖數(shù)據(jù)庫(kù)記錄的是這樣的數(shù)據(jù) import_time 從2017-11-01 到2017-11-31 一個(gè)月的每一天

現(xiàn)在需要統(tǒng)計(jì)出 每一天的記錄數(shù) 保存為count變量

需要 得到類(lèi)似下面數(shù)組哪樣的數(shù)據(jù) sql 語(yǔ)句怎么寫(xiě)尼 大神

array(25) {
  [0]=>
  array(37) {
   ["m_id"]=>
    string(3) "1"
    ["import_time"]=>
    string(10) "2017-11-04"
    ["cout"]=>
    string(10) "3"
  }
  [1]=>
  array(37) {
    ["m_id"]=>
    string(3) "2"
    ["import_time"]=>
    string(10) "2017-11-05"
    ["cout"]=>
    string(10) "2"
  }
回答
編輯回答
挽青絲

--親測(cè)無(wú)誤

SELECT COUNT(import_time) AS [COUNT] FROM [3d_De] WHERE import_time>'2017-11-01' AND import_time<'2017-11-31' GROUP BY import_time 

2017年5月18日 21:29
編輯回答
傲寒

select import_time as days,count(*) counts from youtable group by days order by import_time desc

2017年5月10日 10:26
編輯回答
笑忘初

select m_id,import_time,count(m_id) as count from table where import_time between 2017-11-01 and 2017-11-31 group by import_time

2017年6月6日 14:53