Hax0r

MYSQL: Order by date but empty dates last not first 본문

0x00 개발/Database

MYSQL: Order by date but empty dates last not first

영준이 2015.10.14 18:15
You can do it in MySQL with the ORDER BY clause. Sort by NULL first, then the date.

SELECT * FROM your_table ORDER BY (date_column IS NULL), date_column ASC

Note: This assumes rows without a date are NULL.

0 Comments
댓글쓰기 폼