need to add brackets.
the syntax like :
select ... from tablename order by
(case
when "val1" then field1
when "val2" then field2
else field3 end)
see in the comment on this page
http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html
in your case
SELECT promotion_expires,created_at
FROM `notes` ORDER BY
(CASE WHEN (promotion_expires > NOW()) THEN
'promotion_expires DESC,created_at DESC'
ELSE
'created_at DESC'
END);
Haim Evgi
2010-08-02 06:15:45