我想做的事:
我想检索有关客户的所有数据字段(包括与他相关的表中的所有数据(例如,引用的国家和数据字段的数据字段)
我想将我的查询作为idUser的参数.
这是我的EER图:
我尝试了什么:
SELECT
referralagent.firstName
,referralagent.lastName
,customer.firstName
,customer.lastName
,customer.address
,customer.postcode
,customer.profession
,customer.phoneNumWork
,customer.phoneNumMobile
,customer.phoneNumHome
,country.name
,nationality.name
FROM
customer
INNER JOIN referralagent
ON customer.ReferralAgent_idreferralAgent = referralagent.idReferralAgent
INNER JOIN country
ON customer.countryResidence = country.idCountry
INNER JOIN nationality
ON customer.nationality = nationality.idNationality
WHERE customer.idUser = '7'
问题:
我不相信我尝试过的是“正确”的东西.在那儿
有没有更好的方法呢?