Warm tip: This article is reproduced from serverfault.com, please click

How to count total amount of pending tickets monday in oracle-sql?

发布于 2020-12-04 10:41:12

I want to count the total amount of pending tickets for monday. I don't want the amount of tickets that were moved to pending on monday but the total amount.

table with sample data:

enter image description here


Expected result:
Total pending tickets monday

Questioner
tychopycho
Viewed
0
Gordon Linoff 2020-12-04 20:04:02

If each row represents a ticket, then you can get the number that are pending on a particular day using:

select count(*)
from t
where updated_at < :date and status = 'pending';

Note: This is not going to count "pending" statuses that were changed to another state. This data does not have enough information to answer that. And your question has not explained the state changes.

I would actually suggest that you ask a new question with more comprehensive information about what the states are, how they change as well as sample data and desired results.