的總和 可能重複: MySQL Count data for last 7 days 我有,我需要展示場之和的問題。可以說我有一個記錄如下, detectDate |isp |infection | count
--------------------------------------
2012-10-02 01:00|aaaa |malware |3
2012-10-02 01:30|
我試圖返回從MySQL一個結果是由年份和月份分組,這對於每年/月返回計數.. 這裏是哪裏我開始了: SELECT YEAR(p.pEndDate) AS pYear, MONTHNAME(p.pEndDate) AS pMonth, count(*) AS pNum
FROM projects p
WHERE p.status=3
GROUP BY YEAR(p.pEndDate), MON
如果我有以下實體: public class PocoWithDates
{
public string PocoName { get; set; }
public DateTime CreatedOn { get; set; }
public DateTime LastModified { get; set; }
}
對應於SQL Server 2008中的