– 按照时间分组,并统计数量
SELECT DATE_FORMAT(CreateTime,"%Y年%m月%d日") AS dates,COUNT(*) from orders_1428542131437314052
GROUP BY DATE_FORMAT(CreateTime,"%Y年%m月%d日")
ORDER BY DATE_FORMAT(CreateTime,"%Y年%m月%d日") DESC ;
– 查询
select * from goods a where
(select count(id) from goods b where b.c_id=a.c_id and b.id>a.id) <3