[英]Select all from one table but remove if it exists from another table
[英]select all field from one table and one from another table in mysql
我需要從一個表中選擇所有字段而不指定它們,並且在加入查詢時只從另一個表中選擇一個字段,但出現錯誤。
這是我的代碼。
SELECT staff_research.*, research_details.type
FROM staff_research,research_details
INNER JOIN research_details staff_research
ON research_details.id = staff_research.rid
錯誤正在發生
Unknown column 'staff_research.rid' in 'on clause'
我不知道我錯過了什么,請幫忙!
從From
子句中刪除research_details
表,
SELECT staff_research.*, research_details.type
FROM staff_research
INNER JOIN research_details
ON research_details.id = staff_research.rid
參考:加入語法
嘗試這個:
SELECT sr.*, rd.type
FROM staff_research sr
INNER JOIN research_details rd ON rd.id = sr.rid;
用這個:
您的INNER JOIN
語法不正確。 請使用以下語法改進它。
SELECT staff_research.*, research_details.type
FROM staff_research
INNER JOIN research_details ON research_details.id = staff_research.rid
你使用: INNER JOIN research_details staff_research <-> research_details as staff_research -> error
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.