我想把“市政、教育、教育征用”加在一起,越简单越好。这给了我正在寻找的正确答案。这就是我目前的做法,想知道是否有办法缩短它。
'municipaltax' = epa.assessed_value \* (select tax_rate from EdmontonPropertyTaxRate where tax_rate_type = 'municipal' and tax_year = 2022)
'education' = epa.assessed_value \* (select tax_rate from EdmontonPropertyTaxRate where tax_rate_type = 'education' and tax_year = 2022)
'education requisition allowance' = epa.assessed_value \* (select tax_rate from EdmontonPropertyTaxRate where tax_rate_type = 'education requisition allowance' and tax_year = 2022)
'total tax' = (epa.assessed_value \* (select tax_rate from EdmontonPropertyTaxRate where tax_rate_type = 'municipal' and tax_year = 2022)) +
(epa.assessed_value \* (select tax_rate from EdmontonPropertyTaxRate where tax_rate_type = 'education' and tax_year = 2022)) +
(epa.assessed_value \* (select tax_rate from EdmontonPropertyTaxRate where tax_rate_type = 'education requisition allowance' and tax_year = 2022))
听起来你只是在寻找
epa.assessed_value * (select sum(tax_rate) from EdmontonPropertyTaxRate where tax_rate_type in ('municipal','education','education requisition allowance') and tax_year = 2022)