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
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#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
absolute service time: 0,33 sec
edit mode
|
history
|
discussion
mysql version
1
5.7.12-log
id
uid
score
date
1
3
aaa
15
07.07.2017 00:00:00
2
4
bbb
20
08.07.2017 00:00:00