SQL Window Functions Series: LAG() and LEAD()
Dive deep into the powerful SQL window functions, LAG() and LEAD(). Explore their intricacies, discover real-world examples, and avoid common pitfalls.
2023-12-11
5,975 reads
Dive deep into the powerful SQL window functions, LAG() and LEAD(). Explore their intricacies, discover real-world examples, and avoid common pitfalls.
2023-12-11
5,975 reads
2023-11-29
436 reads
2023-11-22
429 reads
2021-05-31
608 reads
2019-08-05
Using OVER clause with ROW_NUMBER() function to get top ranked employee detail as per each department.
2016-10-25 (first published: 2016-10-03)
737 reads
Having a solid knowledge of the window functions if vital to high performance T-SQL Code. The key to these functions is how the OVER clause is used. This article will dive into how to use the OVER clause.
2019-09-19 (first published: 2015-10-14)
181,638 reads
By Patrick
SQL Server Audit is an efficient way to track and log events that occur...
I presented at SQL Saturday Pittshburgh this past weekend about populating your data warehouse...
By Steve Jones
A customer was asking recently about the RPO for their estate, and I showed...
hi, we just decided to change over to a tab delimited format in a...
Hi everyone, I have a table as below, I would like to strip out...
From this link - https://stackoverflow.com/questions/22005698/how-to-find-all-the-dependencies-of-a-table-in-sql-server I can find all the child dependencies starting from my...
CREATE TABLE t0 ( id INT PRIMARY KEY , field1 VARCHAR(1000) , field2 VARCHAR(MAX)); INSERT INTO t0 SELECT gs.value , REPLICATE ('X', 1000) , REPLICATE ('Y', 1000) FROM generate_series(1, 10, 1) gs; GO
select STRING_AGG(field1, ';') within group (order by id) from t0;
select STRING_AGG(field2, ';') within group (order by id) from t0;