vistadb4 无法识别此 sql 视图脚本。但它适用于 sql2005。有解决办法吗?谢谢。
SELECT DISTINCT ItemCode, SellingPrice
FROM dbo.SalesPurchases AS a
WHERE (KeyID =
(SELECT TOP (1) MAX(KeyID) AS KeyID
FROM dbo.SalesPurchases AS b
GROUP BY ItemCode, Type
HAVING (ItemCode = a.ItemCode) AND (Type = 'purchase')))
GROUP BY ItemCode, SellingPrice