首先我有表SUM_REPANDMAINT, 表格列名:
ACTUAL_COST, PROJECTED_COST, TOTAL_PREV, TOTAL_PRESENT, 方差, VARIANCE_PER, 限制, 成本中心, ID, 厂, BUDGET_YEAR, VERSION,
其次我有View V_SUM_REPANDMAINT, 查看`列名:
USERNAME, CHARGE_CC, BUDGET_YEAR, 版, 厂, CHARGE_CC, PART_DESC, YEAR_DATE_USD,
此图片可能有助于了解此问题:
我需要获得非重复值。
注意:YEAR_DATE_USD的总和基于PLANT AND CHARGE_CC
我的查询:
SELECT
A.ACTUAL_COST,
A.PROJECTED_COST,
A.TOTAL_PREV,
A.TOTAL_PRESENT,
A.VARIANCE,
A.VARIANCE_PER,
A."LIMIT",
A.COST_CENTER,
A.PLANT,
A.BUDGET_YEAR,
A."VERSION",
B.BUDGET_YEAR,
B."VERSION",
B.PLANT,
B.CHARGE_CC,
B.PART_DESC,
B.YEAR_DATE_USD
FROM
CMS.SUM_REPANDMAINT A,
CMS.V_SUM_REPANDMAINT B
WHERE
(A.BUDGET_YEAR = B.BUDGET_YEAR(+)) AND
(A."VERSION" = B."VERSION"(+)) AND
(A.PLANT = B.PLANT(+)) AND
(A.COST_CENTER = B.CHARGE_CC(+)) AND
(B.USERNAME = '[usr_name]')
答案 0 :(得分:3)
尝试在您的唯一列上使用GROUP BY
或DISTINCT
。这将分组一些结果。
文档here
答案 1 :(得分:1)
如果您有重复,则表示: