User-specific gendered comment count

4

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT 
  c.Text 
INTO #coms
FROM Comments c 
WHERE
  c.CreationDate > '09/11/19' AND
  c.CreationDate < '10/11/19'

DECLARE @gendered_comments AS Int
DECLARE @total_comments AS Int

SELECT @total_comments = COUNT(*) FROM #coms
SELECT @gendered_comments = COUNT(*) FROM #coms c
WHERE 
   c.Text LIKE '%[^a-zA-Z0-9]he[^a-zA-Z0-9]%' OR
   c.Text LIKE '%[^a-zA-Z0-9]him[^a-zA-Z0-9]%' OR
   c.Text LIKE '%[^a-zA-Z0-9]his[^a-zA-Z0-9]%' OR
   c.Text LIKE '%[^a-zA-Z0-9]she[^a-zA-Z0-9]%' OR
   c.Text LIKE '%[^a-zA-Z0-9]her[^a-zA-Z0-9]%'


SELECT @total_comments, @gendered_comments

/*

   
SELECT TOP 10 * FROM Comments c

*/

Enter Parameters

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