Quantcast
Channel: Answers for "Selecting multiple ranges from a set of dates"
Browsing latest articles
Browse All 12 View Live

Answer by Squirrel

where ( eventdate - dateadd(day, datediff(day, 0, date_col), 0) >= '01:00:03' and eventdate - dateadd(day, datediff(day, 0, date_col), 0) = '01:50:37' and eventdate - dateadd(day, datediff(day, 0,...

View Article



Answer by Cyborg

SELECT MIN(TestDate),MAX(TestDate) FROM Dt GROUP BY CONVERT(VARCHAR,TestDate,101),DATEPART(HH,TEstDate),DATEPART(Mi,TestDate) Remarks: Dt Is the Table Name and TestDate is the column Name

View Article

Answer by Squirrel

select min(datecol), max(datecol) from yourtable group by convert(smalldatetime, datecol)

View Article

Answer by Phil Factor

I've made the test data a little bit more realistic as it has an error overlapping a second boundary. This solution relies on the data being inserted into the heap in datetime order declare @Dt table...

View Article

Answer by Blackhawk-17

Borrowing heavily from Phil Factor's answer I have a partial solution but one that raises my own question. I can get (sort of) the start and end times of the error bunches and I also get the single...

View Article


Answer by Blackhawk-17

OK, Here goes a better attempt without a quirky update... Again using @Phil Factor's test data: declare @Dt table (TestDate DateTime) insert into @dt (testdate) values (convert(datetime,'26/07/2010...

View Article
Browsing latest articles
Browse All 12 View Live




Latest Images