我在排序表。小提琴可以找到here。在排序中更改NULL的位置
CREATE TABLE test
(
field date NULL
);
INSERT INTO test VALUES
('2000-01-05'),
('2004-01-05'),
(NULL),
('2008-01-05');
SELECT * FROM test ORDER BY field DESC;
結果我得到:
2008-01-05
2004-01-05
2000-01-05
(null)
不過,我需要的結果是這樣的:
(null)
2008-01-05
2004-01-05
2000-01-05
所以NULL值被視爲,如果它比任何其他更高值。是否有可能這樣做?
[ORDER BY DATE顯示NULLS第一次然後最近的日期]的可能的重複(http://stackoverflow.com/questions/821798/order-by-date-showing-nulls-first-then-most-recent-dates ) – GarethD