About 1,600,000 results
Open links in new tab
  1. Lag() with condition in sql server - Stack Overflow

    Lag () with condition in sql server Asked 11 years, 8 months ago Modified 3 years ago Viewed 41k times

  2. Access the "previous row" value in a SELECT statement

    Oracle, PostgreSQL, SQL Server and many more RDBMS engines have analytic functions called LAG and LEAD that do this very thing. In SQL Server prior to 2012 you'd need to do the …

  3. sql server - Lag function for dates in SQL - Stack Overflow

    Nov 1, 2020 · I am using LAG SQL function to get the difference of 2 consecutive dates in the records. THe issue is, the result it is returning is in DATE -TIME format whereas I want it either …

  4. sql server - How to use LEAD and LAG In Where? - Stack Overflow

    Nov 11, 2014 · How to use LEAD and LAG In Where? Asked 10 years, 11 months ago Modified 2 years ago Viewed 38k times

  5. SQL Lag() across multiple rows - Stack Overflow

    Jul 30, 2018 · SQL Lag () across multiple rows Asked 7 years, 1 month ago Modified 7 years, 1 month ago Viewed 14k times

  6. mysql - Lag () function with WHERE clause - Stack Overflow

    I have this sql function that works properly: SELECT out_hum , (out_hum - LAG(out_hum, 1) OVER (ORDER BY id)) As dif FROM excel_table But I want to select all the out_hum when …

  7. sql - Running Total Using LAG Function - Stack Overflow

    Jan 12, 2015 · Running Total Using LAG Function Asked 10 years, 8 months ago Modified 1 year, 9 months ago Viewed 15k times

  8. sql - LAG functions and NULLS - Stack Overflow

    Apr 25, 2016 · How can I tell the LAG function to get the last "not null" value? For example, see my table bellow where I have a few NULL values on column B and C. I'd like to fill the nulls …

  9. sql - Using LAG or Other function in SUM clause - Stack Overflow

    Jan 9, 2014 · Using the lag function i can flag the tickets at the row level but i cant add this to a SUM clause to accomplish my ultimate goal. CASE WHEN …

  10. sql - How to properly write the lag function? - Stack Overflow

    Oct 28, 2022 · How to properly write the lag function? Asked 2 years, 11 months ago Modified 2 years, 11 months ago Viewed 3k times