SELECT COUNT(*) FROM T_User t WHERE t.lastUpdateTime < '2012-11-12';
SELECT COUNT(*), DATE_FORMAT(t1.modify_date, '%Y-%m') AS my_month
FROM T71_ROOM t1
WHERE item_number ='200807294787132966' GROUP BY my_month ;
-- 按月统计
SELECT DATE_FORMAT(t.createTime, '%m') '月份', SUM(t.menuId) '月度交易总额', DATE_FORMAT(t.createTime, '%Y-%m') AS my_month
FROM T_PageMenu3 t
WHERE DATE_FORMAT(t.createTime,'%Y')=2011
GROUP BY my_month;
-- 按年统计
SELECT DATE_FORMAT(t.createTime, '%Y') '年份', SUM(t.menuId) '年度交易总额', DATE_FORMAT(t.createTime, '%Y') AS my_year
FROM T_PageMenu3 t
GROUP BY my_year;
-- 按年测试
SELECT SUM(p.menuId) FROM T_PageMenu3 p WHERE p.createTime BETWEEN '2012-01-01' AND '2012-12-30';
SELECT SUM(p.menuId) FROM T_PageMenu3 p WHERE p.createTime BETWEEN '2011-01-01' AND '2011-12-30';
mysql 统计
最新推荐文章于 2024-08-27 09:43:06 发布