SELECT count(*), lower(name), number FROM tbl GROUP BY lower(name), number HAVING count(*) > 1;
input tb1
slno name number 1 aaa 111 2 Aaa 111 3 abb 221 4 Abb 121 5 cca 131 6 cca 141 7 abc 222 8 cse 222
This query can simply find duplicates in the number and names that are the same, but it cannot find duplicates in the 3rd and 4th row !!!
SELECT count(*), lower(name) FROM tbl GROUP BY lower(name) HAVING count(lower(name)) > 1
this query can find all duplicates by name !!! it works great
SELECT count(*), number FROM tbl GROUP BY number HAVING count(number) > 1
This query can find all duplicates in the room !!! it works great
I need a query that can find all duplicates both by name and by number, whether the name consists of lower case and upper case
output name number count 2 111 aaa 2 --- abb 2 --- cca 2 222 ---
Ghostman
source share