我有3個表MS SQL存儲過程來獲取值
Staff table:
EmpId CandidateId
------------------------
1 2
Candidate table:
CandidateId Firstname Last name CountryId PassportCountry
--------------------------------------------------------------------
1 Mark Antony 2 3
2 Joy terry 1 3
Country:
CountryId Name
---------------------------
1 USA
2 UK
3 Australia
用戶將通過EmpId
的查詢字符串,我需要根據empId
展現候選人的詳細信息。我只有一個country
表,並將該表用於country
,passportport國家。所以我得到country name
時,我得到候選人的價值。
如何編寫存儲過程以獲取候選詳細信息。我不擅長SQL。你們能幫我解決這個問題嗎?提前致謝。
嗨我試了下面的腳本來獲得國家名稱和護照國家名稱。我可以得到國家名稱,但不是護照國家。
SELECT
FirstName,
LastName,
PassportCountry,
Country.CountryName as Country
from Candidate
inner join Country
on country.CountryId=candidate.country
where [email protected];
向我們展示您試過的東西。 – JiggsJedi
你試過了什麼SQL?結果是什麼? –
嗨,我試了下面的腳本來獲得國家名稱和護照國家名稱。我可以得到國家名稱,但不是護照國家。 –