SQLf分组查询,百分比

SELECT
paymentMoney,
total,
contractType,
concat( round( paymentMoney / total * 100.00, 2 ), '%' ) percent
FROM
(
SELECT
sum( amount_money ) paymentMoney,
c.contract_type contractType
FROM
performance p
INNER JOIN contract c ON p.contract_no = c.contract_no
AND c.is_delete = '0'
WHERE
p.status <> '3'
AND p.performance_contents = 2
GROUP BY
c.contract_type
) t1
INNER JOIN (
SELECT
sum( amount_money ) total
FROM
performance p
INNER JOIN contract c ON p.contract_no = c.contract_no
AND c.is_delete = '0'
WHERE
p.status <>'3'
AND p.performance_contents = 2
) t2 ON 1 =1
上一篇:Java中接口和类之间的契约


下一篇:c# – 回调接口契约