Database integration test: list of votes created before their post

1

Please login or register to vote for this query.

(click on this box to dismiss)

Looks this inconsistency is the result of question merges

Computational Science

Q&A for scientists using computers to solve scientific problems

--SELECT MAX(CreationDate) FROM Votes;

/*
SELECT DATEFROMPARTS(
  DATEPART(yyyy, CreationDate),
  DATEPART(m, CreationDate),
  1)
FROM Votes WHERE Id=(SELECT MAX(Id) FROM Votes);
*/

/*
DECLARE @a INT;

SELECT @a=5;

SELECT @a;
*/

WITH Raw AS (
  SELECT
    Votes.Id AS VoteId,
    PostsWithDeleted.Id AS PostId,
    PostsWithDeleted.Id AS [Post Link],
    DATEFROMPARTS(
      DATEPART(yyyy, PostsWithDeleted.CreationDate),
      DATEPART(mm, PostsWithDeleted.CreationDate),
      DATEPART(day, PostsWithDeleted.CreationDate)
    ) AS PostDay,
    Votes.CreationDate AS VoteDay
  FROM PostsWithDeleted, Votes
  WHERE
    PostsWithDeleted.Id = Votes.PostId
)
SELECT *
FROM Raw
WHERE VoteDay < PostDay;

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results