SQLの新機能であり、複数のテーブルにまたがる多数の結合を使用していくつかのデータをプルするクエリがあります。
サンプルデータ:
PERSON_NAME FUNCTION_NAME FUNCTION_ID FUNCTION_GROUP
Bob View Result 1 Editor
Bob Edit Result 4 Editor
Bob Delete Result 3 Editor
Bob Email Result 8 Editor
Mary Print Letter 45 Admin
Mary Grant Access 37 Admin
関数にはIDがあり、function_groupsには多数の関数があります。データをクエリしたいので、上記の例のように表示されるのではなく、次のようになります。
PERSON_NAME FUNCTION_NAME FUNCTION_ID FUNCTION_GROUP
Bob View Result,Edit Result, Delete Result 1,4,3,8 Editor
Mary Print Letter,Grant Access 45,37 Admin
「ボブはエディターに属しています。エディターには次の機能があります」という結果は、最初の例ではなく、次の行が返されます。
ユニークまたは明確なキーワードが私を助けることができると思うのは正しいですか?ありがとう!
編集:今コードで
select staff_member.person_name, function.function_name,staff_group_function.function_id, staff_group.function_group_name
from staff_member
inner join staff_group
on staff_group.staff_group_id=staff_group_member.staff_group_id
inner join staff_group_function
on staff_group_function.staff_group_id=staff_group_member.staff_group_id
inner join function
on function.function_id=staff_group_function.function_group_name