Skip to main content

Taking a Peek at Another Row

  • Chapter
  • First Online:
  • 1291 Accesses

Abstract

Along with accumulating window aggregates, Microsoft added eight new window functions with SQL Server 2012. Four of the functions, which I'll call offset functions in this book, are my favorite T-SQL functions, and they are LAG, LEAD, FIRST_VALUE, and LAST_VALUE. These functions let you include any columns from other rows in your results without a self-join and with fantastic performance.

This is a preview of subscription content, log in via an institution.

Buying options

eBook
USD   19.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Kathi Kellenberger with Clayton Groom

About this chapter

Cite this chapter

Kellenberger, K., Groom, C. (2015). Taking a Peek at Another Row. In: Expert T-SQL Window Functions in SQL Server. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-1103-8_7

Download citation

Publish with us

Policies and ethics