注意:两行数据相减必须先转子查询,转为两列后,才能进行相减

select (n.a-n.b) as c
from 
(select 
(SELECT settlement_amount FROM `domestic_vendor_statements`
where billing_month='202203') a,
(SELECT settlement_amount FROM `domestic_vendor_statements`
where billing_month='202204') b) as n

更多推荐

mysql实现两列数据或者两行数据相减