|
select b.C_CODE, b.C_NAME, SUBSTRing (b.F_CODE, P_NSTYLSTAR, P_NSTYLLEN) FA_CODE, b.F_NAME FA_NAME, b.F_PRICE FA_PRICE, a.NUM_1, a.SUM_1 from percur1 b inner join (select c_code, f_code, sum (num_1) num_1, sum (num_1 * f_price) sum_1 from percur1 group by c_code, f_code) a on b.c_code = a.c_code and b.f_code = a.f_code
Try this, but I don't know how fast it is. Ha ha |
|