最後銷售單價

回覆文章
yehlu
Site Admin
文章: 3245
註冊時間: 2004-04-15 17:20:21
來自: CodeCharge Support Engineer

最後銷售單價

文章 yehlu »

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;
回覆文章

回到「MySQL」