根据每周和年选择数据



我有这个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 

相关内容

  • 没有找到相关文章

最新更新