sql按月查询
答案:3 悬赏:60 手机版
解决时间 2021-03-23 02:04
- 提问者网友:不爱我么
- 2021-03-22 06:16
sql按月查询
最佳答案
- 五星知识达人网友:你可爱的野爹
- 2021-03-22 07:41
select year(timestr) as 年,month(timestr) as 月,count(*) as 聚合函数 from erpworktodo
group by year(timestr),month(timestr)--模仿这个
group by year(timestr),month(timestr)--模仿这个
全部回答
- 1楼网友:毛毛
- 2021-03-22 09:15
select
left(CONVERT(varchar(12),CREAT_TIME,112 ),6),
count(USER_ID) as DATA
from user
where CREAT_TIME between #{startTime} and #{endTime}
group by left(CONVERT(varchar(12),CREAT_TIME,112 ),6)追问运行有错啊,能不能解释一下那个sql语句,我是个新手,谢谢啊!追答什么数据库追问mysql的
left(CONVERT(varchar(12),CREAT_TIME,112 ),6),
count(USER_ID) as DATA
from user
where CREAT_TIME between #{startTime} and #{endTime}
group by left(CONVERT(varchar(12),CREAT_TIME,112 ),6)追问运行有错啊,能不能解释一下那个sql语句,我是个新手,谢谢啊!追答什么数据库追问mysql的
- 2楼网友:舊物识亽
- 2021-03-22 08:14
select to_char(creat_time,'yyyymm') ,
count(USER_ID) as DATA
from user
where CREAT_TIME between #{startTime} and #{endTime}
group by
to_char(creat_time,'yyyymm')
count(USER_ID) as DATA
from user
where CREAT_TIME between #{startTime} and #{endTime}
group by
to_char(creat_time,'yyyymm')
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯