Q&A about the site for serious players and enthusiasts of chess
Select ISNULL(Sum(Cast(ViewCount as BigInt)), 0) From Posts pmd Where pmd.Id In (Select Id From Posts Where PostTypeId = 1 And OwnerUserId = ##UserId## Union Select ParentId From Posts Where PostTypeId = 2 And Id in (select AcceptedAnswerId from Posts) And OwnerUserId = ##UserId## Union Select ParentId From Posts Where PostTypeId = 2 And Score > 5 And OwnerUserId = ##UserId## Union Select a.ParentId From Posts a Join Posts q On a.ParentId = q.Id Where a.PostTypeId = 2 And a.Score > 0.20 * (select sum(Score) from Posts where ParentId=q.Id) And a.Score > 0 And a.OwnerUserId = ##UserId## Union Select x.ParentId From (Select a.ParentId, Rank() Over(Partition By a.ParentId Order By ta.Score Desc) AnswerRank From Posts a Join Posts ta On ta.ParentId = a.ParentId Where a.PostTypeId = 2 And a.Score > 0 And a.OwnerUserId = ##UserId##) x Where AnswerRank <= 3 );