[英]Count the transactions from each with the status CANCELLED per day
| id | status | Transaction date | Vendor | Customer ID |
| 1 | Completed | 2019-11-15 11:46:11 | Vendor A | 12345 |
| 2 | Completed | 2019-11-14 23:03:24 | Vendor B | 67891 |
| 3 | Completed | 2019-11-15 12:04:13 | Vendor C | 456 |
| 4 | Cancelled | 2019-11-14 11:46:11 | Vendor A | 22225 |
| 5 | Cancelled | 2019-11-20 23:03:24 | Vendor B | 789999 |
| 6 | Cancelled | 2019-11-20 12:04:13 | Vendor C | 789999 |
can you help me to count the transactions from each vendor with the status CANCELLED per day guys?你能帮我计算每个供应商的交易,状态为每天取消吗? i'm trying but failed
我正在尝试但失败了
EXPECTATION
Transaction date | Vendor | TOTAL TRANSACTION
2019-11-14 | Vendor A | 1
2019-11-20 | Vendor B | 1
2019-11-20 | Vendor C | 1
Seems that you want the following, which is not what you requested.似乎您想要以下内容,这不是您所要求的。 This is a simple
GROUP BY
.这是一个简单的
GROUP BY
。
SELECT date(transaction_date), vendor, count(*)
FROM table
WHERE status = 'Cancelled'
GROUP BY transaction_date, vendor
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.