日期:2014-05-17 浏览次数:20958 次
select 商品编号, sum(出售件数), sum(总价)
from tab1, tab2
where tab1.id = tab2.order_id(+)
and (tab1的时间范围)
group by 商品编号
SELECT b.product_id, SUM(b.product_num), SUM(b.product_price)
FROM t_tab1 a, t_tab2 b
WHERE a.id = b.order_id(+) AND A.ORDER_TIME BETWEEN DATE1 AND DATE2
GROUP BY b.product_id