title: Max From Select
body: <pre><code>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
  </code></pre>
  
  <p>I need to get Max of this select based on Pharmacylog.pharmacyItemID</p>