我有以下表格
table "users"
------------------------------
user_id name email
------------------------------
1 joe joe@doe.com
2 jane jane@doe.com
3 john john@doe.com
table "code_to_user_ref"
---------------------------------
ref_id user_id code_id
---------------------------------
1 1 1
2 1 2
3 2 3
4 3 4
table "codes"
------------------
code_id code
------------------
1 xC1@3$
2 Cv@3$5
3 Vb#4%6
4 Bn%6&8
Run Code Online (Sandbox Code Playgroud)
基本上,该users表是我所有注册会员的所在地.该codes表只是外部使用的有效激活码列表.该code_to_user_ref表将每个用户映射到他们拥有的代码.
我想要做的是像这样回应一个表:
------------------------------
Name Email Code/s owned
------------------------------
joe joe@... xC1@3$, Cv@3$5
jane jane@... Vb#4%6
john john@... Bn%6&8
Run Code Online (Sandbox Code Playgroud)
我该如何写出这样的查询?