Created
November 2, 2020 10:51
-
-
Save garsaud/ea73ac4a66c8cffeb79f56933cb8bdc4 to your computer and use it in GitHub Desktop.
Record duplicate counts in a column
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update mytable t1 | |
join (select field, count(*) as dup_count from mytable group by field) t2 | |
set t1.count_field = dup_count | |
where t1.field = t2.field |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment