2016-11-26 53 views
0
select userId, firstname, lastname, userVehicleId 
from users 

我要讓usersuserVehicle之間的內部連接。這是我到目前爲止,任何人都可以幫忙嗎?續集專業,SQL語句,加入

[請在此輸入圖像的描述] [2]

內加入 [請在此輸入圖像說明] [1]

select userId, firstname, lastname, userVehicleId 
from users 
inner join userVehicleId 
on userVehicle 
where users.userId = userVehicle.userVehicleId 
+0

你已經標記了很多變種的SQL ....你在用什麼? – scsimon

回答

0

你的問題並不清楚,可能是你需要這個查詢?

select u.userId, u.firstname, u.lastname, u.userVehicleId 
from users u 
inner join userVehicle uv 
on uv.id=u.id 
0

據我所知,你想爲擁有車輛的用戶獲取userId,firstname和lastname,對吧?

它可以是這樣的:

SELECT u.userId, u.firstname, u.lastname, uv.userVehicleId 
FROM users u 
INNER JOIN userVehicle uv 
    ON u.userId=uv.userVehicleId 

請,爲usersuserVehicle表提供結構,以獲得更準確的答案。