Skip to content

Instantly share code, notes, and snippets.

@hudo
Created June 27, 2013 19:24
Show Gist options
  • Save hudo/5879552 to your computer and use it in GitHub Desktop.
Save hudo/5879552 to your computer and use it in GitHub Desktop.
count duplicated titles
update rp
set rp.TitleDuplicateCount = rj.tcount
from ReportPages rp
inner join
(
select count(rp2.TitleHash) as tcount, rp2.TitleHash
from ReportPages rp2
where rp2.ProjectId = {0} and PageType = 1 and HasTitle = 1
group by rp2.TitleHash
having COUNT(rp2.titleHash) > 1
) rj on rp.TitleHash = rj.TitleHash
where rp.ProjectId = {0} and PageType = 1 and HasTitle = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment