Database query corresponding foreign key value display problem
Directly use (select foreign key value from foreign key table where main table. Field = foreign table. Field) to nest in.
Such as the following example:
<!-- 用户列表 -->
<select id="findUser" parameterType = "user" resultType = "user">
select account,
username,
head_src,
(select userstatus from user_status where id = user_info.userstatus) as userstatus
from user_info
</select>
user_info table: user_status table: