我的SQL Case命令出了什么问题?

时间:2013-07-25 14:47:30

标签: mysql

SELECT *
FROM booking  
CASE
WHEN Travel_Date <= getDate() THEN 'Past Travel
ELSE 'Future'
END AS 'Has travel happened'

1 个答案:

答案 0 :(得分:1)

试试这个:

SELECT *, 
  CASE 
    WHEN Travel_Date <= CURDATE() THEN 'Past Travel' 
    ELSE 'Future' 
  END AS 'Has travel happened' 
FROM booking