SELECT MAX(crash_year) AS crash_year, COUNT(crash_year) AS COUNT
FROM nyccrash
GROUP BY crash_year
ORDER BY COUNT(crash_year) DESC;
このステートメントは、20年間の全範囲を返します。しかし、どうすれば一番上の行だけを取得できますか?
+------------+-------+
| crash_year | count |
+------------+-------+
| 1999 | 862 |
| 1990 | 847 |
| 1992 | 812 |
| 1991 | 810 |
| 1993 | 806 |
| 2000 | 803 |
| 1994 | 782 |
| 1989 | 763 |
| 2001 | 729 |
| 1995 | 698 |
| 1997 | 672 |
| 1996 | 671 |
| 1998 | 665 |
| 2002 | 497 |
| 2003 | 419 |
| 2006 | 384 |
| 2004 | 377 |
| 2007 | 364 |
| 2005 | 363 |
+------------+-------+