0
Hello, I have a table similar to:
user_id server_id record date_record
123 333 3 2020-05-10
343 343 4 2020-05-12
133 333 5 2020-05-15
123 333 10 2020-06-10
343 343 12 2020-05-12
123 333 5 2020-05-15
123 433 50 2020-05-10
In this table, records can be repeated by user_id.
I need SQL command that:
- Select the best 25 users (the best 25 records), ignoring repeated data.
So in the case of user_id 123, the command should only return the maior registro(maior record)
, ignoring the previous records with least record.
What do I have:
SELECT user_id, server_id, user_record FROM user_ranking ORDER BY user_record DESC LIMIT 100;
The result I desire:(based on the example)
user_id server_id record date_record
123 433 50 2020-05-10
343 343 12 2020-05-12
133 333 5 2020-05-15
"highest record(highest record)" here’s your answer, use it with
group by
and will have the desired result. If you have questions, you have several questions aboutgroup by
here– Ricardo Pontual