I have this table:
id name
1 AAA
2 BBB
3 BBB
4 BBB
5 AAA
6 CCC
How can I get this?
id name count
1 AAA 2
2 BBB 3
3 BBB 3
4 BBB 3
5 AAA 2
6 CCC 1
I want to count duplicates(name), getting all rows, WITHOUT grouping it.
Thank you.
You can use a correlated subquery:
Demo here