A SQL window-function that returns the rank of each row within a result set partition.
Questions tagged [sql-rank]
20 questions
-1
votes
2 answers
SQL Rank based on column value
I have a requirement to give rank based on the column value in table
Condition:
prioritize JobType in the order of 1: 75, 2: 76, 3: 80 , 4: 64
When there are two contacts with same JobType, prioritize RANK with
OrderCount Desc
Table also has other…

kishore
- 1
- 2
-1
votes
2 answers
How to rank for this query
I want to generate the below result and here is my query
SET @count:=0;
SELECT Workout.created_by, SUM(Workout.training_load) as TL, FB_User.name
from FB_Workout
INNER join FB_User ON FB_Workout.created_by = FB_User.id
where FB_Workout.created_at…

RK0703
- 1
- 4
-1
votes
1 answer
How to get top 10 data weekly (This week, Previous week, Last month, 2 months ago, 3 month ago)
I want to retrieve the Top 10 Products - weekly
Rank This week product Previous week rank Last month rank 2 month ago rank 3 month ago rank
1 Watch 2 3 1 …

Ramiz Tariq
- 387
- 10
- 27
-1
votes
1 answer
Issues selecting rows with next row's IDs
This question is a follow-up to Select first rank if RANK()+1 overflows with JOINS
The scenario
I have a bunch of predefined messages that my Discord and Twitch bots send to dedicated channels every 30 minutes in round-robin only if X messages where…

dan
- 3,439
- 17
- 54
- 82
-1
votes
1 answer
SQL Rank over partition to C# Linq
I am just starting to code in C# and need some direction with achieving the SQL Rank over partition within C# ( LINQ)
I have retrieved the following data from the database and have stored the SQL result in a data table within c#. the column 'Score'…

Priyak Bandyo
- 9
- 2