Please help me with below data. How should I query it.
x
Name Speed Tier Usage
Andrew 200 5000
Andrew 100 2000
Luis 100 1000
I need to query it in a way that it shows the name which has highest usage. Below is the example
Name Speed Tier Usage
Andrew 200 5000
Luis 100 1000
Advertisement
Answer
Use a correlated subquery:
select t.*
from t
where t.usage = (select max(t2.usage) from t t2 where t2.name = t.name);