I have this table in mysql:
+----+------+------------+-------+
| id | code |    date    | value |
+----+------+------------+-------+
| 1  |   3  | 2016-01-01 |   3   |
| 2  |   3  | 2016-01-02 |   4   |
| 3  |   3  | 2016-03-01 |   6   |
| 4  |   3  | 2016-06-06 |   5   |
| 5  |   8  | 2016-01-01 |   1   |
| 6  |   8  | 2016-09-09 |   3   |
+----+------+------------+-------+
I want to return a table like this:
+------+------------+-------+
| code |    date    | value |
+------+------------+-------+
|  3   | 2016-06-06 |   5   |
|  8   | 2016-09-09 |   3   |
+------+------------+-------+
My server setings is:
**MySQL**
Server: localhost via TCP/IP
Server version: 5.5.16
Protocol version: 10
User: root@localhost
MySQL charset: UTF-8 Unicode (utf8)
**Web server**
Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8
MySQL client version: mysqlnd 5.0.8-dev - 20102224 - $Revision: 310735 $
I tried this script and not work:
SELECT *
FROM tbl_mysql
WHERE date IN (SELECT MAX(date) FROM tbl_mysql GROUP BY code)
How can I change the script to work on my server version? Thank you!
 
     
     
    