最後銷售單價
發表於 : 2009-12-22 15:10:00
select sell_id,prod_id,price from sell_a as s inner join (select prod_id as prod_id1,max(sell_id) as sell_id1 from sell_a group by prod_id) as s1 on s.sell_id = s1.sell_id1 and s.prod_id = s1.prod_id1;
select s.prod_id,price from stock_po_a s,(select stock_po_id,prod_id,max(stock_in_date) from stock_po_a group by prod_id) s1 where s.stock_po_id = s1.stock_po_id and s.prod_id = s1.prod_id group by s.prod_id;
select s.prod_id,price from stock_po_a s,(select stock_po_id,prod_id,max(stock_in_date) from stock_po_a group by prod_id) s1 where s.stock_po_id = s1.stock_po_id and s.prod_id = s1.prod_id group by s.prod_id;