0
我有我的實體條目,並希望返回最近15天的日期和條目數的計數,並將數據顯示在圖表中。創建原則查詢
但是,DQL正在寫作是某種失敗,不會帶來我想要的結果,如果有人可能會提供幫助,我將不勝感激。
這是我想在MySQL
SELECT count(*) as total, DATE_FORMAT(e.created_at, '%Y-%m-%d') as date FROM entries e WHERE e.created_at BETWEEN DATE_SUB(CURDATE(),INTERVAL 15 DAY) AND CURDATE() GROUP BY date
這裏實現查詢我有:
$sql = "SELECT count(*) as total, DATE_FORMAT(e.created_at, '%Y-%m-%d') as date FROM entries e WHERE e.created_at BETWEEN DATE_SUB(CURDATE(),INTERVAL 15 DAY) AND CURDATE() GROUP BY date";
$q = $this->em->createQuery($sql);
$registered = $query->getResult();