给出表格
+-------------+----------+
| a.id | a.val |
+-------------+----------+
| A | 2 |
| B | 3 |
| A | 4 |
| B | 5 |
| C | 6 |
+-------------+----------+
+-------------+
| b.id |
+-------------+
| A |
| B |
| C |
+-------------+
如何为每个ID选择一个值来获取:
+-------------+----------+
| a.id | a.val |
+-------------+----------+
| A | 2 |
| B | 3 |
| C | 6 |
+-------------+----------+
(我可以用行号来做到这一点,但想要一种高效的方法,它不会选择所有内容,而是先删除不重要的内容)