I'm trying to fetch values on joining two tables and getting those into a map, in MyBatis.
For example, two tables, "ABC" and "XYZ:
Table ABC columns: id
and code
Table XYZ columns: id
, pid
and relation_with_user
Query being used:
select xyz.id as cId, xyz.relation_with_user as relationWithUser
from ABC abc left join XYZ xyz
on abc.id = xyz.pid where code = #{code}
The resultant map should be Map(Integer, String)
.
I want to set the id
of the XYZ table as key and relation_with_user
as value in the map. How can I do that?