日期:2014-05-17 浏览次数:20482 次
SELECT * FROM ICPrcPlyEntry AS Price INNER JOIN
(SELECT FItemID,FRelatedID,FCuryID,FUnitID,max(FBegDate) AS FBegDate FROM ICPrcPlyEntry
GROUP BY FItemID,FRelatedID,FUnitID,FCuryID) AS Ref
ON Ref.FItemID=Price.FItemID AND Ref.FRelatedID=Price.FRelatedID AND
Ref.FUnitID = Price.FUnitID AND Ref.FCuryID=Price.FCuryID AND Price.FBegDate=Ref.FBegDate
SELECT *
FROM ICPrcPlyEntry AS Price
INNER JOIN
(
SELECT FItemID,FRelatedID,
FCuryID,FUnitID,
max(FBegDate) AS FBegDate
FROM ICPrcPlyEntry
GROUP BY FItemID,FRelatedID,FUnitID,FCuryID
) AS Ref
ON
Ref.FItemID=Price.FItemID AND
Ref.FRelatedID=Price.FRelatedID AND
Ref.FUnitID = Price.FUnitID AND
Ref.FCuryID=Price.FCuryID AND
Price.FBegDate=Ref.FBegDate