2014-09-01 43 views
-2

我想顯示即將到來的生日。 生日是用mysql的時間戳存儲的。獲取即將到來的生日mysql時間戳

我在與後續的代碼前面的問題中發現:

select * 
from t 
order by (case when month(date(from_unixtimestamp(user_birth))) = month(now()) and 
       day(date(from_unixtimestamp(user_birth))) > day(now()) or 
       month(date(from_unixtimestamp(user_birth))) > month(now()) 
      then 1 else 0 
     end) desc, 
    month(date(from_unixtimestamp(user_birth))), 
    day(date(from_unixtimestamp(user_birth))) 
limit 6 

但是,這並不對功能from_unixtimestamp()工作,我的服務器上不存在。

我怎樣才能做到這一點?

回答