I have the following info in my database:
+-----------------------+-------------+
| USERNAME TRUST | |
+-----------------------+-------------+
| DeaDTerra | 390 |
| OgNasty | 322 |
| Blazed | 303 |
| monbux | 260 |
| Tomatocage | 230 |
| Stunna | 220 |
| philipma1957 | 216 |
| John (John K.) | 180 |
| CanaryInTheMine | 173 |
| Mitchell | 165 |
+-----------------------+-------------+
I want to run a query that will return the following:
+----------------------+
| USERNAME RANK |
+----------------------+
| Blazed 3 |
+----------------------+
I have tried the following query:
select top 25 username, trust, RANK() over (order by trust desc) AS Rank
from btcProfile
where profile_name='Blazed' order by trust
All I get is this:
+----------------------+
| USERNAME RANK |
+----------------------+
| Blazed 1 |
+----------------------+
How do I only pull up the one record but calculate the RANK()
based on all rows in the table?