SQL文を教えて下さい。
user_id 毎の最新の bills 一覧を得る SELECT 文はどう書けば良いのでしょうか?
テーブル定義
mysql> desc bills;
+---------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| user_id | int(11) | YES | MUL | NULL | |
| created_at | datetime | YES | | NULL | |
+---------------------+--------------+------+-----+---------+----------------+
サンプル
+----+---------+------------+
| id | user_id | created_at |
+----+---------+------------+
| 1 | 111 | 2015-01-01 |
+----+---------+------------+
| 2 | 111 | 2015-01-02 |
+----+---------+------------+
| 3 | 111 | 2015-01-03 | ← 111 の中で最新の日付
+----+---------+------------+
| 4 | 222 | 2015-01-02 | ← 222 の中で最新の日付
+----+---------+------------+
| 5 | 222 | 2015-01-01 |
+----+---------+------------+
期待する結果
+----+---------+------------+
| id | user_id | created_at |
+----+---------+------------+
| 3 | 111 | 2015-01-03 |
+----+---------+------------+
| 4 | 222 | 2015-01-02 |
+----+---------+------------+