2013-07-04 71 views
-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馬克斯選擇

+5

是什麼「這個選擇的最大」是指?最多是什麼? – Lamak

回答

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 
+0

這是...其實是一個很好的猜測 – Lamak

+0

謝謝它工作:) –