---
title: "LEAD / LAG"
canonical: "https://support.targit.com/space/TT/337739798/LEAD%20%2F%20LAG"
format: markdown
---
[Cloud release: 2026.06.17]  
[On-prem release: 2026 October]  
[On-prem build: 26.10.05006]  
 

Added support for LEAD and LAG functions e.g.

```

select customerid, freight, lead(freight,1) over (partition by customerid order by freight)
as lead2 from orders order by customerid,freight
```


It takes 2 parameters and the second parameter has to be a positive integer less than 2^31.

If a second parameter is not specified it will default to one.

Does not support IGNORE NULLS | RESPECT NULLS syntax. Currently implementation uses RESPECT NULL behavior.

Does not support specifying a third parameter to specify a default value for nulls.

LEAD returns values N rows after current record according to the partition and order by clause.