Q&A for parents, grandparents, nannies and others with a parenting role
SELECT c.CreationDate, CASE WHEN (2 = p.PostTypeId) THEN 'Answer' WHEN (1 = p.PostTypeId) THEN 'Question' ELSE 'UNKNOWN' END AS Type, c.Id [Comment Link], c.Score, n.TotalComments, CASE WHEN (2 = p.PostTypeId) THEN t.Title ELSE p.Title END AS Title FROM Comments c LEFT OUTER JOIN Posts p on (c.PostId = p.Id) LEFT OUTER JOIN Posts t on (p.ParentId = t.Id) LEFT OUTER JOIN (SELECT c.PostId, COUNT(c.PostId) TotalComments FROM Comments c GROUP BY c.PostId) n on (c.PostId = n.PostId) WHERE p.DeletionDate is NULL AND p.ClosedDate is NULL AND (1 = p.PostTypeId or 2 = p.PostTypeId) AND -- only needed on Stack Overflow c.CreationDate <= DATEADD(DAY, -1000, GETDATE()) AND c.CreationDate >= DATEADD(DAY, -1000, GETDATE()) AND (1=2 -- Golden Hammer triggers --OR UPPER(c.Text) LIKE UPPER('%fuck%') -- Normal flag rules apply --OR UPPER(c.Text) LIKE UPPER('%piss%') OR UPPER(c.Text) LIKE UPPER('%retard%') --OR UPPER(c.Text) LIKE UPPER('%jerk%') --OR UPPER(c.Text) LIKE UPPER('%bitch%') --OR UPPER(c.Text) LIKE UPPER('%nitwit%') --OR ( UPPER(c.Text) LIKE UPPER( '%turd%') --AND NOT UPPER(c.Text) LIKE UPPER('%sturday%') --AND NOT UPPER(c.Text) LIKE UPPER('%sturdy%') --) -- End of query )