我有这个sql:
SELECT YEAR(`end`) as week, WEEK(`end`) as year
FROM table
WHERE week=24 AND year=2016
,但我得到了错误Unknown column week in where clause
。我在做什么错?请帮帮我。提前THX
您无法在where
子句中使用别名,尝试以下;)
SELECT WEEK(`end`) as week, YEAR(`end`) as year
FROM table
WHERE WEEK(`end`)=24 AND YEAR(`end`)=2016