|
Er, no, freedom actually.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
What?
Anything that is unrelated to elephants is irrelephant Anonymous
- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944
- I'd just like a chance to prove that money can't make me happy. Me, all the time
|
|
|
|
|
Ignore him Naughtius, he thinks he is the messiah but he is a very naughty boy. Might be your son.
|
|
|
|
|
Yeah, they said I hadn't done anything and I could go and live on an island somewhere.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Oh I say, that's very nice. Well, off you go then...
Anything that is unrelated to elephants is irrelephant Anonymous
- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944
- I'd just like a chance to prove that money can't make me happy. Me, all the time
|
|
|
|
|
|
|
Living life on the Dark Side!
Rules for the FOSW ![ ^]
if(this.signature != "")
{
MessageBox.Show("This is my signature: " + Environment.NewLine + signature);
}
else
{
MessageBox.Show("404-Signature not found");
}
|
|
|
|
|
My life is more like The Far Side than the dark side.
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
|
If you want to be ahead of time, check LEAD[^]...
IMHO, rewriting is only necessary if performance is extremely important...Also notice that LAG (and LEAD) can gain you performance only if you use hard coded offset values!
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Kornfeld Eliyahu Peter wrote: If you want to be ahead of time, check LEAD[^]...
Or make the Offset negative.
|
|
|
|
|
MSDN: offset cannot be a negative
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Oh, when I tested it on Oracle I could. Oh well...
|
|
|
|
|
OriginalGriff wrote: do I rewrite the code to use it?
If it ain't broke, don't fix it.
Unless you are a consultant. In which case, you fix it which breaks it then fix it again which does not work so revert back to old stuff. Then, go out for a vacation using all the big money you made from this.
"You'd have to be a floating database guru clad in a white toga and ghandi level of sereneness to fix this goddamn clusterfuck.", BruceN[ ^]
|
|
|
|
|
d@nish wrote: Unless you are a consultant. In which case, you fix it which breaks it then fix it again which does not work so revert back to old stuff. Then, go out for a vacation using all the big money you made from this.
I don't Think Griff's boss (Mrs. Griff) will go for that approach...
Anything that is unrelated to elephants is irrelephant Anonymous
- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944
- I'd just like a chance to prove that money can't make me happy. Me, all the time
|
|
|
|
|
|
In my - slight - defence, I only upgraded to SQL Server 2012 about 6 months ago when I found my hosting service wasn't using 2008R2 any more...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
A small note, Lead and Lag really likes Composite indices. In your example on (UserId,EnterDate)
|
|
|
|
|
Note 2.
Remember the order of execution, analytic functions are the third last to happen in a query.
Joins, filtering, aggregation all happens before the analytic functions. Only Unions and Order By happens after.
|
|
|
|
|
|
I know what you mean, but ... it's what SSMS does when you ask for a "Top 1000 rows" query, which I used to test the LAG function. And I can see why it does it; it does make a lot of sense in terms of avoiding the "missing" or "leftover" comma. But it does look bad.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Well, at least you removed those horrible brackets!
"Go forth into the source" - Neal Morse
|
|
|
|
|
They're easier to get rid of!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
OriginalGriff wrote: it does make a lot of sense in terms of avoiding the "missing" or "leftover" comma.
Until you remove the first column from the list.
Or add a column before it.
Basically, it just moves the problem from the end of the column list to the start.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|