DATEDIFF (SQL Server Compact)
Returns the number of date and time boundaries crossed between two specified dates.
The following example determines the number of days it took to ship the orders made by a company that has a Customer ID of 'VINET'.
SELECT [Order ID], DATEDIFF(d, [Order Date], [Shipped Date]) AS [Shipping Time in Days] FROM Orders WHERE ([Customer ID] = 'VINET')
This is the result set:
OrderID Shipping Time in Days ------------------------------------- 10295 8 10737 7 10274 10 10248 12 10739 5
