您是否可以使用单个SQL按当前日期和未来日期以及按字母顺序在当前日期和未来日期内对事件进行排序?
请给我举个例子?
谢谢:)
答案 0 :(得分:2)
您可以使用类似
的内容SELECT *
FROM TABLE
ORDER BY Col1 ASC, Col2 DESC,...
查看ORDER BY Clause (Transact-SQL)
[ ORDER BY
{
order_by_expression
[ COLLATE collation_name ]
[ ASC | DESC ]
} [ ,...n ]
]
答案 1 :(得分:1)
您可能需要以下内容:
where publishedAt>CURRENT_TIMESTAMP order by publishedAt asc, title asc
答案 2 :(得分:1)
ORDER BY CASE WHEN = CurrentDate THEN 0 ELSE 1 END,AlphaField