我有一张包含日期和值的表格。我要做的是获取值的 MAX() 值和对应于该值的日期。IE
+------------+-------+
| pdate | score |
+------------+-------+
| 2012-05-01 | 80 |
| 2012-05-02 | 50 |
| 2012-05-03 | 52 |
| 2012-04-02 | 100 |
| 2012-05-02 | 10 |
+------------+-------+
我想要的输出是 2012-04-02 - 100
这是我的查询:
SELECT pdate,MAX(Score) as maxscore FROM tblpulse
WHERE DID = '171488' && pdate BETWEEN '2012-05-02'
AND '2012-06-26' and pdate ORDER BY pdate ASC