-2
Create proc [dbo].[SpGetPharmacyLogpast]
AS
SELECT  Pharmacylog.PharmcyItemID,Pharmacylog.PastQuantity,Pharmacylog.NowQuantity,Pharmacylog.Amount,Pharmacylog.TotalValue,PharmacyItems.ID  from Pharmacylog
LEFT JOIN PharmacyItems
ON  PharmacyItems.ID=Pharmacylog.PharmcyItemID where PharmacyItems.ItemID=8

RETURN

我需要根据 Pharmacylog.pharmacyItemID 获取此选择的 Max

4

1 回答 1

1

我同意@lamak 的问题。

但疯狂的猜测:

Create proc [dbo].[SpGetPharmacyLogpast]
AS
SELECT  TOP 1 Pharmacylog.PharmcyItemID,Pharmacylog.PastQuantity,Pharmacylog.NowQuantity,Pharmacylog.Amount,Pharmacylog.TotalValue,PharmacyItems.ID  
from Pharmacylog 
LEFT JOIN PharmacyItems
ON  PharmacyItems.ID=Pharmacylog.PharmcyItemID 
where PharmacyItems.ItemID=8
ORDER BY Pharmacylog.PharmcyItemID DESC 
RETURN
于 2013-07-04T20:25:40.277 回答