Linked Questions

2
votes
1answer
6k views

how to get rank number that group by a column [duplicate]

I spend hours trying to solve this, but I can't. Well, I simply have a table call invoices I have data like this I want to know each customer rank by their total sum How can I archive this?
4
votes
2answers
11k views

How to get latest 2 records of each group

So, I have table similar to: sn color value 1 red 4 2 red 8 3 green 5 4 red 2 5 green 4 6 green 3 Now I need the latest 2 rows for each color, eg: 2 red 8 4 red 2 5 green 4 6 ...
0
votes
2answers
6k views

MySQL Query to get rank of a student

I have a table with the following structure. CREATE TABLE `score` ( `sid` INT NULL, `name` INT NULL, `rollno` INT NULL, `examid` INT NULL, `phone` INT NULL, `dob` INT NULL, ...
0
votes
3answers
987 views

Retrieving row ranking in a table

I'm aware there are already many questions alike however none of those answers helped me achieve row rankings in a table. I have a table set up as so: +----------------------------------+-----------...
1
vote
2answers
1k views

MySQL 8 - user variables within expressions is deprecated [UDF calls with lot of parameters]

I have this: SELECT @foo1 := UDF1(0, a, b, c, d) AS Foo1, @foo2 := UDF1(1, a, b, c, d) AS Foo2, @foo3 := UDF1(2, a, b, c, d) AS Foo3, @foo4 := UDF1(3, a, b, c, d) AS Foo4, @foo5 := ...
1
vote
1answer
703 views

MySQL: Rank by Department in an employees table

I need Mysql query to rank the hours used by each department in an employees table, but it just ranks all without taking into consideration the departments.
0
votes
1answer
196 views

Embedded select with rank

I am having the hardest time following the tutorials on this site regarding ranking with MySQL. I have a larger problem than others seem to show. My table is constantly updating with single answers (...
0
votes
1answer
227 views

Get the rank of a row based on a score I am generating from other field values

I am trying to figure out how I can get the rank of a row from a score I am generating from other field values. The score query looks something like this SELECT ((table2.field1*0.4) + (table2....
0
votes
0answers
41 views

MySQL Query to get rank of a student of specific class divison or group

I just stuck in one area and I am glad if you help me out of this problem. My problem is similar to Get the rank of a user in a score table But here is twist you already mentioned how to use WHERE ...
0
votes
2answers
47 views

Getting Ranked Position - SQL - Simple Query

I have a very simple database structure and am struggling to write a command to find the ranked position of the user. ------------------ id | average ------------------ 1 | 79 ------------...