Click here to Skip to main content
15,913,685 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
JokeRe: MQOTD Pin
RUs12318-Feb-16 0:51
RUs12318-Feb-16 0:51 
GeneralRe: MQOTD Pin
OriginalGriff18-Feb-16 0:53
mveOriginalGriff18-Feb-16 0:53 
GeneralRe: MQOTD Pin
Johnny J.18-Feb-16 1:06
professionalJohnny J.18-Feb-16 1:06 
GeneralRe: MQOTD Pin
RUs12318-Feb-16 0:31
RUs12318-Feb-16 0:31 
JokeTurned to the dark side? Pin
Kornfeld Eliyahu Peter17-Feb-16 23:20
professionalKornfeld Eliyahu Peter17-Feb-16 23:20 
GeneralRe: Turned to the dark side? Pin
HobbyProggy17-Feb-16 23:40
professionalHobbyProggy17-Feb-16 23:40 
GeneralRe: Turned to the dark side? Pin
Chris Quinn18-Feb-16 2:30
Chris Quinn18-Feb-16 2:30 
GeneralI know I'm behind the times sometimes... Pin
OriginalGriff17-Feb-16 22:26
mveOriginalGriff17-Feb-16 22:26 
...but I've just discovered the SQL LAG function.
Wow, but that's a fwappy feature! Thumbs Up | :thumbsup:

Makes it so simple to get a running delta for users:
SQL
SELECT UserID
      ,EnterDate
      ,CurrentValue
      ,CurrentValue - LAG(CurrentValue, 1 , CurrentValue) OVER (PARTITION BY UserId ORDER BY EnterDate ASC) AS Delta
FROM MyTable

So, no more nasty multiple SELECT and JOINS, no more C# loops once the data is loaded - just a simple addition to the SQL SELECT.
Why didn't I find this a couple of years ago? D'Oh! | :doh:

Now the big decision: do I rewrite the code to use it? Don't have any mods planned for that software... Unsure | :~
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

GeneralRe: I know I'm behind the times sometimes... Pin
Kornfeld Eliyahu Peter17-Feb-16 22:33
professionalKornfeld Eliyahu Peter17-Feb-16 22:33 
GeneralRe: I know I'm behind the times sometimes... Pin
Jörgen Andersson17-Feb-16 23:16
professionalJörgen Andersson17-Feb-16 23:16 
GeneralRe: I know I'm behind the times sometimes... Pin
Kornfeld Eliyahu Peter17-Feb-16 23:20
professionalKornfeld Eliyahu Peter17-Feb-16 23:20 
GeneralRe: I know I'm behind the times sometimes... Pin
Jörgen Andersson17-Feb-16 23:26
professionalJörgen Andersson17-Feb-16 23:26 
GeneralRe: I know I'm behind the times sometimes... Pin
dan!sh 17-Feb-16 22:38
professional dan!sh 17-Feb-16 22:38 
GeneralRe: I know I'm behind the times sometimes... Pin
Johnny J.17-Feb-16 22:52
professionalJohnny J.17-Feb-16 22:52 
GeneralRe: I know I'm behind the times sometimes... Pin
Sander Rossel17-Feb-16 22:58
professionalSander Rossel17-Feb-16 22:58 
GeneralRe: I know I'm behind the times sometimes... Pin
OriginalGriff17-Feb-16 23:13
mveOriginalGriff17-Feb-16 23:13 
GeneralRe: I know I'm behind the times sometimes... Pin
Jörgen Andersson17-Feb-16 23:19
professionalJörgen Andersson17-Feb-16 23:19 
GeneralRe: I know I'm behind the times sometimes... Pin
Jörgen Andersson17-Feb-16 23:25
professionalJörgen Andersson17-Feb-16 23:25 
RantRe: I know I'm behind the times sometimes... Pin
ZurdoDev18-Feb-16 1:44
professionalZurdoDev18-Feb-16 1:44 
GeneralRe: I know I'm behind the times sometimes... Pin
OriginalGriff18-Feb-16 1:48
mveOriginalGriff18-Feb-16 1:48 
GeneralRe: I know I'm behind the times sometimes... Pin
kmoorevs18-Feb-16 2:42
kmoorevs18-Feb-16 2:42 
GeneralRe: I know I'm behind the times sometimes... Pin
OriginalGriff18-Feb-16 2:49
mveOriginalGriff18-Feb-16 2:49 
GeneralRe: I know I'm behind the times sometimes... Pin
Richard Deeming18-Feb-16 3:22
mveRichard Deeming18-Feb-16 3:22 
GeneralCCC WSO 18, February 2016 - Solved Pin
Kornfeld Eliyahu Peter17-Feb-16 22:01
professionalKornfeld Eliyahu Peter17-Feb-16 22:01 
GeneralRe: CCC WSO 18, February 2016 PinPopular
NeverJustHere17-Feb-16 22:05
NeverJustHere17-Feb-16 22:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.