MySQL #1054 unknown column

£可爱£侵袭症+ 提交于 2019-12-02 01:19:40

Every column you use in the HAVING clause of your query must be present in the selected columns. HAVING works on the calculated values (for instance if you use the SUM() function you can use the calculated sum in the HAVING clause.)

Also note that if you give a column an alias you have to use the alias in the HAVING clause.

For more information on hidden columns and HAVING: http://dev.mysql.com/doc/refman/5.0/en/group-by-hidden-columns.html

Try to use wd.Datum in your select.

Its common in sql, if you are using a column in having clause, you have to add that column in select. What happens is like it will create a virtual table with the columns you have selected and filter with the condition in having clause.

--- Make it as answered if it really answered your question.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!