SELECT COMPANY_SEGMENT, totalMoney,educationMoney,cityEducationMoney, (totalMoney+constructionMoney+educationMoney+cityEducationMoney) FROM (SELECT COMPANY_SEGMENT, sum( abs( PERIOD_OCCURRENCE ) ) AS "totalMoney", sum( abs( PERIOD_OCCURRENCE ) ) * 0.07 AS "constructionMoney", sum( abs( PERIOD_OCCURRENCE ) ) * 0.03 AS "educationMoney", sum( abs( PERIOD_OCCURRENCE ) ) * 0.02 AS "cityEducationMoney" FROM INTELLIGENT_BALANCE_FORWARD WHERE IS_FLAG = 0 AND ACCOUNT_SEGMENT = '2104080100' GROUP BY COMPANY_SEGMENT) GROUP BY COMPANY_SEGMENT
时间: 2024-04-15 07:29:31 浏览: 74
segment_cut(LSTMorAttention+CRF)_cut_segment_
5星 · 资源好评率100%
您的查询语句如下:
```
SELECT COMPANY_SEGMENT, totalMoney, educationMoney, cityEducationMoney, (totalMoney+constructionMoney+educationMoney+cityEducationMoney)
FROM (
SELECT
COMPANY_SEGMENT,
SUM(ABS(PERIOD_OCCURRENCE)) AS totalMoney,
SUM(ABS(PERIOD_OCCURRENCE)) * 0.07 AS constructionMoney,
SUM(ABS(PERIOD_OCCURRENCE)) * 0.03 AS educationMoney,
SUM(ABS(PERIOD_OCCURRENCE)) * 0.02 AS cityEducationMoney
FROM
INTELLIGENT_BALANCE_FORWARD
WHERE
IS_FLAG = 0
AND ACCOUNT_SEGMENT = '2104080100'
GROUP BY
COMPANY_SEGMENT
)
GROUP BY COMPANY_SEGMENT;
```
这个查询语句从表`INTELLIGENT_BALANCE_FORWARD`中选择了满足条件`IS_FLAG = 0`和`ACCOUNT_SEGMENT = '2104080100'`的记录。然后,根据`COMPANY_SEGMENT`对结果进行分组,并计算了每个分组的总金额(`totalMoney`)、建设金额(`constructionMoney`)、教育金额(`educationMoney`)、城市教育金额(`cityEducationMoney`)和总金额(`totalMoney+constructionMoney+educationMoney+cityEducationMoney`)。最后,按照`COMPANY_SEGMENT`进行分组并返回结果。
阅读全文