Skip to content

Instantly share code, notes, and snippets.

@eulerfx
Created April 26, 2012 03:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eulerfx/2495688 to your computer and use it in GitHub Desktop.
Save eulerfx/2495688 to your computer and use it in GitHub Desktop.
IOrderRepository.GetMostRecent SQL
select top(@max)
Id,
OrderNumber,
Date,
Total = o.TaxCharge + o.ShippingCharge + (select sum(i.Amount * i.Quantity) from OrderLineItems i where i.OrderId = o.Id)
from Orders o
where o.CustomerId = @customerId
order by o.Date desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment