在报表中使用SUM,其中值来自多个表

时间:2014-03-12 15:39:05

标签: mysql sql oracle sum oracle-apex

1 个答案:

答案 0 :(得分:0)

如果要对Sum进行分组,请在 group by 子句中添加列,如下所示

SELECT SUM(JL_Price + PART_PRICE) , cloumn_name
    FROM GMS_Job_List, GMS_Parts, GMS_Appointments
    WHERE JL_ID=AP_Job_Type
        AND Part_ID=AP_Part_Used
       AND instr((AP_Job_ID),nvl(:JOB,AP_Job_ID))>0
    GROUP BY cloumn_name

这里是column_name我用来对总和进行分组