查询Joining两个表以获得引用中第二个表的结果



我有两个表Order和Transaction

订单表格

TransId2021年1月12日2021年2月12日2021年9月12日
id OrderId订单日期
1 54 11151
2 55 111552
3 56 11553 2021年2月12日
4 57 11554 2021年5月12日
5 58 11555 2021年8月12日
6 59 11556
select t.paymentMethod, sum(t.amount) from tbl_order o
inner join tbl_transaction t on o.orderId = t.orderId 
where t.paymentMethod = 'CASH' and o.orderDate between start_date and end_date
group by t.paymentMethod;   

最新更新