我需要對MySQL表上的同一個字段進行查詢,但使用不同的參數。這是我的查詢。出現的問題是,MySQL說用戶名是不明確的。MySQL說這個列不明確
SELECT projects_id,
projects_users_id,projects_companies_id,projects_name,
projects_description,project_registered_date,
projects_users_id_register,
users.users_name as userInCharge,companies.companies_name as company,
users.users_name as user_register FROM projects
LEFT JOIN users as userInCharge ON (users_id = projects_users_id)
LEFT JOIN users as register ON (users_id=projects_users_id_register)
LEFT JOIN companies ON (companies_id = projects_companies_id) ORDER BY projects_id DESC
我的目標是獲得項目負責人和註冊該項目的人員的ID。我該怎麼做呢?
您正在重複users.users_name選擇 – Mihai