源表是:
+----------------------------+
| Col A | Col B | Col C |
+-------+--------------------+
| 100 | 1 | 1/2/2012 |
| 100 | 2 | 1/2/2012 |
| 100 | 3 | 1/2/2012 |
| 100 | 1 | 5/2/2012 |
| 100 | 2 | 5/2/2012 |
| 100 | 3 | 5/2/2012 |
+-------+-------+------------+
期望的结果:
+-----------------------------+
| Col A | Col B | Col C |
+-------+--------+------------+
| 100 | 1 | 5/2/2012 |
| 100 | 2 | 5/2/2012 |
| 100 | 3 | 5/2/2012 |
+-------+--------+------------+
我们如何使用 SQL 获取它?
我试过了
SELECT * FROM Table A
GROUP BY Col C
HAVING Col C = max(Col C) AND Col A = '100'
但它似乎不起作用。