失效语句:
获取的change_date不是最大值
sql
select product_id, new_price, change_date
from (
select product_id ,new_price, change_date
from Products
order by change_date desc
) as a
group by product_id
生效语句:
增加distinct使order by生效
sql
select product_id, new_price, change_date
from (
select distinct(product_id) product_id, new_price, change_date
from Products
order by change_date desc
) as a
group by product_id