SELECT
A.*, SUM(B.amount)
FROM
erp_customer A
LEFT JOIN (
SELECT
*
FROM
erp_order
WHERE
`status` = 1
) B ON A.id = B.customer_id
WHERE
A.`status` = 1
GROUP BY
A.id
$query = Customer::find()->alias("A")->where(['A.status'=>Customer::STATUS_ACTIVE]);
$query->leftJoin('','A.id = B.customer_id','select * from erp_order as B');
$query->select(['A.*,sum(B.amount) as amount']);
上面的sql语句 用这种形式怎么写 求解