Det enklaste vore att använda en CTE
med ROW_NUMBER
funktion:
WITH CTE AS
(
SELECT dbo.twProducts.title, dbo.LowestPrices.productAsin, dbo.twProducts.sku,
dbo.LowestPrices.tweAmzPrice, dbo.LowestPrices.price, dbo.LowestPrices.priceDate,
RN = ROW_NUMBER()OVER( PARTITION BY productAsin ORDER BY priceDate DESC)
FROM dbo.aboProducts INNER JOIN
dbo.LowestPrices ON dbo.aboProducts.asin = dbo.LowestPrices.productAsin
INNER JOIN dbo.twProducts ON dbo.aboProducts.sku = dbo.twProducts.sku
)
SELECT * FROM CTE WHERE RN = 1