我需要使用ORACLE SQL检索在“创建日期”之前创建并在“创建日期”组之后由“创建日期”列解决的“已解决票数”
Ticket# Created_Date Solved_Date
3315279 12-MAR-19 15-MAR-19
3355379 10-MAR-19 14-MAR-19
3378633 11-MAR-19 15-MAR-19
3470592 13-MAR-19 16-MAR-19
3472784 13-MAR-19 16-MAR-19
3472930 13-MAR-19 16-MAR-19
3473119 13-MAR-19 16-MAR-19
3474194 11-MAR-19 14-MAR-19
3721765 12-MAR-19 16-MAR-19
3723124 12-FEB-19 16-MAR-19
3723286 07-MAR-19 14-MAR-19
3724733 05-MAR-19 16-MAR-19
3724894 03-MAR-19 14-MAR-19
3750270 09-MAR-19 14-MAR-19
3751118 06-MAR-19 14-MAR-19
来自评论:
答案 0 :(得分:0)
这是查询-
select t1.creation_date,count(t1.ticketno) as count
from ticket_demo t1, ticket_demo t2
where t2.creation_date <t1.creation_date and t2.solved_date>t1.creation_date
group by t1.creation_date;
TICKETNO CREATION_DATE SOLVED_DATE
1 01-01-18 12-04-18
2 01-12-17 04-01-18
3 01-11-17 01-01-18
4 01-02-18 28-02-18
5 03-04-18 04-05-18
6 01-04-18 04-05-18
7 01-01-18 05-06-18
O / P-
CREATION_DATE COUNT
03-04-18 3
01-04-18 2
01-02-18 2
01-01-18 2
01-12-17 1