我想构建一个 SELECT 语句,可以根据条件命名结果。为了更好地解释我的尝试,我构建了以下无效/无效语句。如何将以下 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