我有以下SQL語句:錯誤代碼:1054未知列
SELECT efforts.user_id, project_tasks.task_name, sum(hours)
FROM efforts, users, project_tasks
INNER JOIN PROJECT_TASKS pu ON efforts.project_task_id = pu.id
INNER JOIN USERS u ON efforts.users_id = u.id
WHERE project_tasks.project_id = '2';
當我運行它,我得到以下錯誤:
Error Code: 1054. Unknown column 'efforts.project_task_id' in 'on clause'
爲什麼會出現這個錯誤?
Project_task_id屬於工作表
更新時間:
SELECT u.full_name, pu.task_name, hours
FROM efforts
INNER JOIN project_tasks pu ON efforts.project_task_id = pu.id
INNER JOIN users u ON efforts.user_id = u.id
GROUP BY user_id, task_name
沒有u必須努力表此列? –
請提供努力表的表格描述.. – StevieG
我已添加下面的圖像以顯示我的表格 – David