SELECT o.member_id,SUM(o.payable),o.gmt_modify
FROM orders o,order_detail od
WHERE TO_DAYS(o.gmt_modify) >=TO_DAYS(("2013-02-27 10:22:53.000000"))
AND TO_DAYS(ADDDATE(("2013-05-27 10:22:53.000000"),INTERVAL -16 DAY)) >=TO_DAYS(o.gmt_modify)
AND od.shipping_statu = 2 AND o.id =od.order_id GROUP BY o.member_id
SELECT r.member_id,SUM(r.product_price),r.gmt_modify
FROM returned_goods r WHERE TO_DAYS(r.gmt_modify) >=TO_DAYS(("2013-02-27 10:22:53.000000"))
AND TO_DAYS(("2013-05-27 10:22:53.000000")) >=TO_DAYS(r.gmt_modify)
AND r.returned_status NOT IN(1,4,11)
AND r.returned_type NOT IN(2) GROUP BY r.member_id
把这2个查出来的数据 会员id相同的 payable-product.price