Skip to content
Advertisement

Counting unique pairs, but applying that count to all of its entries in SQL (not removing duplicates)

Let’s say I have a table:

And I want my table output to be:

but with the code I have here my output looks like this

Any way I can create an sql query to is like my top table vs the one I make currently Using: 10.5.5-MariaDB

Advertisement

Answer

Use window functions:

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement