I want to design a query to compute some returns for stock data and in searching the 'SQL Server Books Online' I find a very small and not so helpful at all help section on the lead and lag functions.
difference with lag length truncated and missing values converted to zero; If you do not specify n, the number of periods is assumed to be one. For example, LAG(X) is the same as LAG1(X). No more than ...