Viewing 15 posts - 16 through 30 (of 475 total)
Sorry this is a bit of a "It Depends" answer. If you are only going to have up to eight courses then the following will do what you want.
WITH...
October 23, 2014 at 7:48 pm
You could try the following
SELECT *, ISNULL(DATEDIFF(mi, LAG(CreateDate,1) OVER (ORDER BY ID), CreateDate), 0) AS Duration
FROM MyTable
Edit:
To refine it a bit more by using default and removing isnull
SELECT...
October 15, 2014 at 4:50 pm
I've removed the rcte version as that appeared to be behaving badly. The looped version appears to work OK.
To avoid issues where distances in the procedure get calculated badly...
September 24, 2014 at 8:38 pm
**Insert bad word here**, I've either translated the python wrong or it doesn't work.
I've just tried it with some of my real data rather than the mocked up points I...
September 24, 2014 at 7:40 pm
Thinking about this a bit more. If you replace the distance calculation in the current version with the haversine formula, you should get a reasonably accurate median.
So replace
denomsum =...
September 24, 2014 at 1:34 pm
busraker (9/24/2014)
Well that didn't go so well ....
...
SELECT@tempx = EXP(SUM(LOG(geogpt.Long))/COUNT(*)),
@tempy = EXP(SUM(LOG(geogpt.Lat))/COUNT(*)) FROM @geogPts
...
END
Yields:
(6 row(s) affected)
Msg 3623, Level 16, State 1, Line 13
An invalid floating point operation occurred.
The floating...
September 24, 2014 at 1:04 pm
Basically what you want to do is a Cross Tab query or a Pivot.
Here's a couple of links
http://www.sqlservercentral.com/articles/T-SQL/63681/
http://technet.microsoft.com/en-us/library/ms177410(v=sql.105).aspx
So a crosstab example for your query would be
SELECT a.StudentID,
MAX(CASE WHEN Reader#...
September 23, 2014 at 8:43 pm
While I'm on a bit of a roll. Had a bit of success with a rCTE, but it does require a iTVF to be created.
Removed: Incorrect results
September 22, 2014 at 6:06 pm
Looking at it further, it may not be so bad in t-sql.
Here's my crack at it. It currently uses a while loop because I'm having a few issues turning...
September 22, 2014 at 4:42 pm
I've had a quick look at this and I suspect while it could be done in T-SQL (painfully and slowly :-D), a CLR function built around your C++ would probably...
September 22, 2014 at 1:57 pm
andyscott (9/16/2014)
September 16, 2014 at 1:31 pm
Eirikur Eiriksson (9/15/2014)
mickyT's solution is straight forward, just make certain that the direction...
September 15, 2014 at 2:35 pm
Viewing 15 posts - 16 through 30 (of 475 total)