您需要 SORT desc 列 start_Date 上的函数。以下是将产生您想要的结果的查询。
select * from table1
order by Start_Date desc;
您可以查看 sqlfiddle 演示 here
如果日期是将来,您必须使用asc 来获得您想要的结果。
select * from table1
order by Start_Date asc;
如果您的日期是过去和未来日期的混合,如以下示例数据。
ID Name Start_Date
---------------------
1 abc 2018-01-01
2 efg 2018-02-05
3 pqr 2018-01-16
4 xyz 2018-02-19
1 abc 2017-01-01
2 efg 2017-02-05
3 pqr 2017-01-16
4 xyz 2017-02-19
下面的查询可以选择以更友好的格式显示数据。
select * from (
select * from table1
where start_date < current_date
order by start_date desc
) as B
union
select 0,'TODAY_DATE', current_date
union
select * from (
select * from table1
where start_date > current_date
order by start_date asc
) as A
它将以desc顺序对过去日期数据进行排序,然后将TODAY日期添加到结果中,然后以asc格式添加未来数据,如下所示。
ID Name Start_Date
--------------------------
4 xyz 2017-02-19
2 efg 2017-02-05
3 pqr 2017-01-16
1 abc 2017-01-01
0 TODAY_DATE 2017-08-18
1 abc 2018-01-01
3 pqr 2018-01-16
2 efg 2018-02-05
4 xyz 2018-02-19
查看 SQLfiddle 演示 here