tags:

views:

76

answers:

3

Hi,

Can you have a single SQL that order events by current day then future dates and within current day and future dates in alphabetic order?

Please show me an example?

Thanks :)

+2  A: 

You can use something like

SELECT *
FROM TABLE
ORDER BY Col1 ASC, Col2 DESC,...

Have a look at ORDER BY Clause (Transact-SQL)

[ ORDER BY 
    {
    order_by_expression 
  [ COLLATE collation_name ] 
  [ ASC | DESC ] 
    } [ ,...n ] 
] 
astander
+1  A: 

You probably need something like:

where publishedAt>CURRENT_TIMESTAMP order by publishedAt asc, title asc
cherouvim
I think something like `>= CONVERT (date, GETDATE())` might be needed instead of `> CURRENT_TIMESTAMP` in order to get all events for the current day.
Gabe
+1  A: 

ORDER BY CASE WHEN date = CurrentDate THEN 0 ELSE 1 END, AlphaField

le dorfier