Posts with activity after your last comment

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow на русском

Вопросы и ответы для программистов

select P.Id as [Post Link], P.LastActivityDate, C.Id as [Comment Link], C.CreationDate, P.OwnerUserId as [User Link], P.LastEditorUserId as [User Link]
  from Comments as C inner join Posts as P
  on P.Id = C.PostId
  where C.UserId = ##UserId:int## 
  and C.CreationDate =
  (
    SELECT MAX(a.CreationDate) FROM Comments AS a
    WHERE a.UserId = C.UserId and a.PostId = C.PostId      
  )
  and (C.CreationDate < P.LastActivityDate)
  and (P.OwnerUserId != C.UserId)
  and (P.LastEditorUserId != C.UserId)
  order by P.LastActivityDate DESC

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results