【发布时间】:2020-02-18 06:06:28
【问题描述】:
我有 mysql 表“booking”,我想根据 PaymentStatus 得到结果
订桌
id shop_id paymentStatus amount
1 2 1 50
2 2 1 60
3 2 2 40
4 2 2 90
我想根据 PaymentStatus 获得预订总数(结果应该像 paymentStatus=1 的 2 个预订,paymentStatus=2 的 2 个预订) 和根据 PaymentStatus 的总金额(PaymentStatus=1 的总金额 110,paymentStatus=2 的总金额 130) 我该怎么做?
【问题讨论】:
-
嗨,欢迎来到 stackoverflow。你试过什么?你检查过sql tutorial 上的 w3school 指南吗?