TSQL: How to use LEAD() and LAG() functions in analytic data

Problems I have a data set that describe Sales data of all categories. Now I need to build a query to compare Sales of a given year with previous year for each category. For example, I have a data set of SALES Now, I need to build a report to analyze how much sales of previous year … Continue reading TSQL: How to use LEAD() and LAG() functions in analytic data

Advertisements

TSQL: Pagination data with OFFSET and FETCH in SQL Server 2012

Scenarios In the prior SQL edition, you often use combination of ROW_NUMBER and ORDER BY whenever you want to implement pagination data in SQL Server. From SQL Server 2012, Microsoft announced a new functions to support pagination data. They are OFFSET and FETCH. In this article, I am going to introduce how to use them for … Continue reading TSQL: Pagination data with OFFSET and FETCH in SQL Server 2012