Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Get max score and the fields in the max score row in MySQL 5.7
#MySQL 5.7.12 #please drop objects you've created at the end of the script #or check for their existance before creating #'\\' is a delimiter select version() as 'mysql version'; DROP TABLE data; CREATE TABLE data (`id` int, `uid` varchar(3), `score` int, `date` datetime) ; INSERT INTO data (`id`, `uid`, `score`, `date`) VALUES (1, 'aaa', 10, '2017-07-07 00:00:00'), (2, 'bbb', 5, '2017-07-07 00:00:00'), (3, 'aaa', 15, '2017-07-07 00:00:00'), (4, 'bbb', 20, '2017-07-08 00:00:00') ; select a.* from data a left join data b on a.uid = b.uid and a.score < b.score where b.uid is null
run
|
edit
|
history
|
help
0
emp
Point System Alpha
CS
EquiposLiga
Ordenar Valores de Columnas
barbato
new_road
SRINIVAS
ze
Patel