SQL:查找每年如何进行计算

时间:2020-12-11 16:57:56

I have this data, and I want to know how are pending, hold accepted and rejected in every month and every year.i stored date as string.these details from form.i am using hibernate.

我有这些数据,我想知道如何挂起,保持接受和拒绝在每个月和每年。我存储日期为string.these详细信息来自form.i我正在使用hibernate。

request      | status
-----------  | ------
31-7-2017    | pending 
2017-07-26   | accepted
2017-07-29   | hold
31-7-2017    | hold 
31-7-2017    | accepted
31-7-2017    | pending
2017-7-31    | rejected
2017-7-31    | pending
2017-7-31    | accepted

Thanks in advance.

提前致谢。

1 个解决方案

#1


0  

SELECT DISTINCT status,
day(request) , YEAR(request) , count(*) FROM
GROUP BY day(request) , YEAR(request) ,status

SELECT DISTINCT status,day(request),YEAR(request),count(*)FROM GROUP BY day(request),YEAR(request),status

#1


0  

SELECT DISTINCT status,
day(request) , YEAR(request) , count(*) FROM
GROUP BY day(request) , YEAR(request) ,status

SELECT DISTINCT status,day(request),YEAR(request),count(*)FROM GROUP BY day(request),YEAR(request),status