Q&A about the site for administrators, end users, developers and designers for Craft CMS
Select distinct q1.before, q2.after, q3.timeforCW from (select count(posthistory.Id) as 'before' from posthistory inner join posts on posts.id = posthistory.postid where posthistory.creationdate< posts.CommunityOwnedDate and posts.Id=200284 and posthistorytypeid in (4,5,6,7,8,9)) as q1 , (select count(posthistory.Id) as 'after' from posthistory inner join posts on posts.id = posthistory.postid where posthistory.creationdate> posts.CommunityOwnedDate and posts.Id=200284 and posthistorytypeid in (4,5,6,7,8,9)) as q2 , (SELECT DATEDIFF(hour, Posts.CreationDate, CommunityOwnedDate) as 'timeforCW' FROM Posts INNER JOIN PostHistory ON Posts.Id=PostHistory.PostId where Posts.PostTypeId=1 and posts.Id=200284) as q3