簡體   English   中英

在mysql中從一個表中選擇所有字段,從另一個表中選擇一個

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM