Sql排序日期如何



这是我当前的表格:

+---+----------+
| id| date     |
+---+----------+
| 1 |2014-05-05|
+---+----------+
| 2 |2014-05-06|
+---+----------+
| 3 |2014-05-06|
+---+----------+
| 4 |2014-05-07|
+---+----------+
| 5 |2014-05-07|
+---+----------+
| 6 |2014-05-07|
+---+----------+

这些是我正在寻找的结果:

+---+----------+
| id| date     |
+---+----------+
| 1 |2014-05-05|
+---+----------+
| 2 |2014-05-06|
+---+----------+
| 4 |2014-05-07|
+---+----------+
SELECT MIN(ID), DATE FROM TABLE_NAME GROUP BY DATE;

相关内容

  • 没有找到相关文章

最新更新