select top(2) a.id as [Post Link], a.CreationDate, q.Crea...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Open Source Meta

Q&A about the site for people organizing, marketing or licensing open source development projects

select top(2)
  a.id as [Post Link],
  a.CreationDate,
  q.CreationDate,
  ph.CreationDate,
  ph.PostHistoryTypeId
  --datepart(year, a.CreationDate),
  --count(*)
from
  posts as a
  right join posthistory as ph on ph.PostId = a.ParentId
  left join posts as q on q.Id = ph.PostId
where
  (1 = 1)
  and a.PostTypeId = 2
  and q.PostTypeId = 1
  and (
    ph.PostHistoryTypeId = 10 and ph.CreationDate < a.CreationDate
    or
    ph.PostHistoryTypeId = 11 and ph.CreationDate > a.CreationDate
  )
  --and q.ClosedDate < a.CreationDate
/*
group by
  datepart(year, a.CreationDate)
order by
  datepart(year, a.CreationDate) asc*/

Enter Parameters

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