Comments with the same text

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow на русском

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

-- SiteName: Stack Exchange site name ('stackoverflow' etc.)

with CommentsEx as (
  select
    *,
    lower(rtrim(ltrim(
      replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(
        replace(replace(replace(replace(replace(replace(
          case charindex('@', Text)
            when 1 then substring(Text, charindex(' ', Text), len(Text))
            else Text
          end,
          '.', ' '), '!', ' '), '?', ' '), ',', ' '), ':', ' '), '(', ' '), ')', ' '), '=', ' '), '[', ' '), ']', ' '), '/', ' '),
        '  ', ' '), '  ', ' '), '  ', ' '), '  ', ' '), '  ', ' '), '  ', ' ')
      ))) as [TextClean]
  from
    Comments
)

select top 1000
  count(c.Id) as [Count],
  c.TextClean as [Text],
  concat('http://data.stackexchange.com/', ##SiteName:string?ru##, '/query/315118/?CommentId=', min(c.Id), '|See') as [See]
from
  CommentsEx as c
group by
  c.TextClean
having
  count(c.Id) > 1
order by
  count(c.Id) desc

Enter Parameters

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