Acceptable question data


Please login or register to vote for this query.

(click on this box to dismiss)

Software Engineering

Q&A for professionals, academics, and students working within the systems development life cycle

DECLARE @LastFullDayOfData DATE;

SELECT @LastFullDayOfData = DATEADD(DAY, -1, MAX(CONVERT(DATE, [CreationDate])))
FROM [Posts]
print @LastFullDayOfData

  CONVERT(DATE, [p].[CreationDate]) [Date],
  DATEPART(WEEKDAY, [p].[CreationDate]) [DayOfWeek],
  DATEPART(HOUR, [p].[CreationDate]) [HourOfDay],
  CASE WHEN ([ClosedDate] IS NULL AND [DeletionDate] IS NULL AND [Score] > 0) THEN 1 ELSE 0 END [Acceptable],
  CASE WHEN DATEPART(WEEKDAY, [p].[CreationDate]) > 1 AND DATEPART(WEEKDAY, [p].[CreationDate]) < 7 THEN 1 ELSE 0 END [Weekday]
  [Posts] [p]
WHERE 1 = 1
  AND [p].[CreationDate] <= @LastFullDayOfData
  AND [p].[PostTypeId] = 1
ORDER BY [p].[CreationDate] DESC

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results