Skip to main content

Home/ isrdataanalysts/ Group items matching "tsql" in title, tags, annotations or url

Group items matching
in title, tags, annotations or url

Sort By: Relevance | Date Filter: All | Bookmarks | Topics Simple Middle
robertm50

SQL SERVER - Solution to Puzzle - Simulate LEAD() and LAG() without Using SQL Server 2012 Analytic Function | Journey to SQL Authority with Pinal Dave - 0 views

  •  
    "CASE WHEN N%2=1 THEN MAX(CASE WHEN N%2=0 THEN SalesOrderDetailID END) OVER (Partition BY (N+1)/2) ELSE MAX(CASE WHEN N%2=1 THEN SalesOrderDetailID END) OVER (Partition BY N/2) END LeadVal, CASE WHEN N%2=1 THEN MAX(CASE WHEN N%2=0 THEN SalesOrderDetailID END) OVER (Partition BY N/2) ELSE MAX(CASE WHEN N%2=1 THEN SalesOrderDetailID END) OVER (Partition BY (N+1)/2) END LagVal FROM T1"
1 - 3 of 3
Showing 20 items per page