Current vote data state

1

Please login or register to vote for this query.

(click on this box to dismiss)

Arts and Crafts Meta

Q&A about the site for artists and crafters

SELECT
  VoteTypes.Id,
  VoteTypes.Name,
  p.Count,
  p.First,
  p.Last,
  p.HasUserId,
  p.ExactDate
FROM VoteTypes
LEFT JOIN (
  SELECT
    VoteTypeId,
    COUNT(*) AS Count,
    MIN(CreationDate) AS First,
    MAX(CreationDate) AS Last,
    COUNT(UserId) AS HasUserId,
    COUNT(
      CASE
        WHEN CreationDate <> DATEFROMPARTS(
          YEAR(CreationDate), MONTH(CreationDate), DAY(CreationDate))
        THEN 1
      END) AS ExactDate
  FROM Votes
  GROUP BY VoteTypeId
  ) p ON VoteTypes.Id = p.VoteTypeId
ORDER BY VoteTypes.Id

Enter Parameters

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