場景:ide
查詢出 圖書和食品兩個分類(或多個分類) 在最新的一天內的商品銷售狀況 it
select a.* from prod_sales a INNER JOINclass
(select prod_class,max(sales_date) as sn from prod_salesdate
GROUP BY prod_class) b select
on a.prod_class=b.prod_class and a.sales_date=b.sn order by prod_class查詢