Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.databases.ms-sqlserver    |    Notorious Rube Goldberg contraption    |    19,505 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 18,257 of 19,505    |
|    Erland Sommarskog to Henk van den Berg    |
|    Re: Help needed to write a qury    |
|    25 Apr 11 15:30:53    |
      From: esquel@sommarskog.se              Henk van den Berg (hvandenberg@xs4all.nl) writes:       > Here's the create/insert stuff.       >       > Since I'm trying to get my head around CTE and partition by/over order       > by, I'd appreciate a pointer if you can find the time for it.              Thanks for the sample data!              I see that I had forgot the join condition on EmpId - without the query is       kind of meaningless.              The principle is simple: number the rows, and then make a self-join on       the row number with the next number.              --       Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se              Links for SQL Server Books Online:       SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx       SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca