我想構建一個可以根據條件命名結果的SELECT語句。爲了更好地解釋我的嘗試,我構建了以下無效/非工作聲明。如何將以下SELECT語句改爲實際爲我的原因工作的SELECT語句。謝謝!MYSQL - SELECT語句,可以根據條件命名結果
SELECT
CASE
WHEN dayStart LIKE '2012-06-11%' THEN UNIX_TIMESTAMP(dayStart) as today
WHEN dayStart LIKE '2012-06-10%' THEN UNIX_TIMESTAMP(dayStart) as yest
WHEN dayStart LIKE '2012-06-12%' THEN UNIX_TIMESTAMP(dayStart) as tomor
END
FROM dayBook
WHERE userID = 1