'Check which member has the most connections
I want to create a query, based on excel file.
I have a two columns table that shows transactions between friends. I want to know which member has the most friends (it doesn't matter if he being paid or pays money).
Of course, two transations to or from the same person counts as one (I want to see how many friends, not how many times did he pay/got paid) table
| paid | pays |
|---|---|
| 18 | 14 |
| 1 | 17 |
| 20 | 12 |
| 11 | 12 |
| 8 | 20 |
| 3 | 6 |
| 4 | 2 |
| 20 | 9 |
| 10 | 8 |
| 20 | 5 |
| 16 | 14 |
| 2 | 5 |
| 1 | 12 |
| 10 | 14 |
| 3 | 6 |
| 4 | 14 |
| 2 | 6 |
| 11 | 14 |
Solution 1:[1]
select max value from sub query like below example
select paid from (select paid,sum(pays) as `pays` from tbl) where pays=max(pays)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Salman ansari |
