发布网友 发布时间:2022-04-10 22:37
共1个回答
热心网友 时间:2022-04-11 00:06
SELECT SUM(payment_alreadyprice) FROM property_payment WHERE year(payment_time) = year(curdate())追问修改后执行只有一个值,,,1200,还缺个全部的数量,可以放到一起吗?追答SELECT SUM(payment_alreadyprice) as currentYearNum,(SELECT SUM(payment_alreadyprice) FROM property_payment) as allYearNum FROM property_payment WHERE year(payment_time) = year(curdate())
或者
SELECT SUM(payment_alreadyprice) FROM property_payment WHERE year(payment_time) = year(curdate())
union all
SELECT SUM(payment_alreadyprice) FROM property_payment
第二条语句需要用一个list来接收