0
我試圖讓我的柱使用具有等於過濾器包含的,但問題是,它給出了這樣的錯誤消息:列在HAVING子句中無效,因爲它不是在聚合函數或GROUP BY
column is invalid in the HAVING clause because it is not contained in either an aggregate function or the GROUP BY
,當我嘗試添加過濾器的選擇和組由它說:
Column names in each view or function must be unique
,因爲無論是列和過濾器是相同的:
列:
userTable.userid
過濾器:
user_filter.userid
這裏是我的代碼:
SELECT DISTINCT
userId,
username,
sum(userItem)
from userTable inner join user_filter
on userTable.userName = user_filter.userName
group by userId,
username,
having userTable.userId = user_filter.userId
編輯您的問題幷包含生成錯誤的查詢。 –
好吧,我會添加查詢 – abdu
你究竟在努力實現什麼?當兩個表都有'userid'時,爲什麼你用'username'加入?爲什麼userfilter在用戶名已經在'usertable'中時有'username'? –