1

SELECT DATEADD(day, DATEDIFF(day, 1, ab.CreatedDate), '09:00:00') as NextDate


1

SELECT DATEADD(Hour, 8, CAST(CAST(DATEADD(Day, 1, [CreatedDate]) AS DATE) AS DATETIME)) As NextDate This will basically force the field to 8am on the next day after CreatedDate, regardless of what time of the day is in CreatedDate. What I'm doing here is adding a day to CreatedDate, forcing it back to just a date (so the time part is removed), then forcing ...


1

I think the issue was that you were using the open domain field instead of the sent domain field. This means that (due to your conditional) only those that are in the Open DV will be counted and since you need to be sent to in order to open, then the numbers will be identical. Another thing I would look at is converting eventdate to date only (removing time) ...


1

If possible, I would suggest breaking your query out into two segments that can separate leap years from non-leap years. Then, you could add a column IsLeapYear so that you can check the type in your outer subquery and run the correct manipulation to your date. I haven't tested this logic, but here's an example: SELECT CASE WHEN x.IsLeapYear = 1 THEN ...


Only top voted, non community-wiki answers of a minimum length are eligible