Viewing 15 posts - 1,981 through 1,995 (of 3,957 total)
If you don't like magic numbers, I think you can do it this way too:
select
a.DT,
LastDayofMonth = dateadd(mm,datediff(mm,-1,a.DT),-1),
LastSundayofMonth =
dateadd(dd,(datediff(dd,'17530107',dateadd(mm,datediff(mm,-1,a.DT),-1))/7)*7,'17530107'),
DwainsWay =
1+dateadd(mm,datediff(mm,-1,a.DT),-1)-DATEPART(weekday, dateadd(mm,datediff(mm,-1,a.DT),-1))
from
(...
February 11, 2013 at 2:59 am
Something like this perhaps?
DECLARE @Paths TABLE (
INT,
INT)
INSERT INTO @Paths
SELECT 1 , 2
UNION ALL SELECT 2 , 3
UNION ALL SELECT 3 , 4
UNION ALL SELECT 1 , 4
UNION...
February 11, 2013 at 2:38 am
Then again, there's always some schmo that's going to come along and try to beat it.
SELECT TestNum, Jeff=CASE
...
February 11, 2013 at 2:21 am
ChrisM@Work (2/11/2013)
Gabriel Priester wrote an article discussing the calculation of moving average. Various alternatives are covered in the discussion.
A QU for moving averages??? :w00t: Who'da thunk it!
February 11, 2013 at 1:33 am
I know I must be doing something wrong here so will somebody please check me?
SELECT TestNum, Jeff=CASE
WHEN...
February 11, 2013 at 1:13 am
Try removing some of the TestNode data for ELMARA and then see if the modified query gives you what you want.
--union
--select '01/27/2012 05:00:00','PEACH BOTTOM','ELMARA',7
--select '02/06/2012 05:00:00','PEACH BOTTOM','ELMARA',6
--union
--select '02/10/2012 05:00:00','PEACH BOTTOM','ELMARA',-41
--union
SELECT...
February 10, 2013 at 7:56 pm
OPC.THREE was asking you to put your data into a format something like this:
DECLARE @switches TABLE
(ID INT IDENTITY
,MyDate DATETIME
...
February 10, 2013 at 7:10 pm
SQLRNNR (2/10/2013)
L' Eomot Inversé (2/8/2013)
Lynn Pettis (2/8/2013)
Revenant (2/8/2013)
Lynn Pettis (2/8/2013)
Am I (shudder) an idiot?No. Is there anything that make you think you are?
🙂
Not really, other than having someone call me...
February 10, 2013 at 6:48 pm
Jeff Moden (2/9/2013)
SQL Kiwi (2/9/2013)
Kwisatz78 (2/8/2013)
February 10, 2013 at 6:44 pm
If your TestNode data contains contiguous dates (meaning no missing dates) for both source/sinks (as provided), there is no need to use the TestDate table.
SELECT a.Sink, a.[Source], a.TimePoint, [20DayAvg]=AVG(a.Delta)
FROM TestNode...
February 10, 2013 at 6:20 pm
Sean Lange (2/8/2013)
dwain.c (2/7/2013)
SELECT Div_time, Unit_id
,TimeDifferenceMin=DATEDIFF(minute, MIN(Filled_Time), MAX(Filled_Time))
FROM #Something
GROUP BY Unit_id, Div_time
HAVING MAX(Filled_Time)...
February 10, 2013 at 5:36 pm
greg.bull (2/8/2013)
2) I did hope, cunningly, that the "threat" of cursors might trigger some kind of reaction from you.Greg.
:w00t::crying::-P:angry:!!!!CURSORS!!!!:w00t::crying::-P:angry:
Grrrrr!!!!!
February 8, 2013 at 2:04 am
greg.bull (2/8/2013)
February 8, 2013 at 1:47 am
Sean Lange (2/7/2013)
Select Id,
MAX(Case When ItemNumber = 1 Then Item Else '' End) As...
February 8, 2013 at 1:09 am
Viewing 15 posts - 1,981 through 1,995 (of 3,957 total)