i have three tables like follows:
this one table : m_application_resources
resourceid resource_name menu_group_id menu_name creation_date last_created_by updation_date last_updated_by
and the second table : m_roles
roleid rolename description creation_date last_created_by updation_date last_updated_by
and the third table is : m_access_matrix
accessid resourceid roleid creation_date last_created_by updation_date last_updated_by
Relationship for the table is : resourceid and roleid
and this my query
select am.accessid, ar.resource_name,rls.rolename
from m_application_resources ar, m_roles rls,m_access_matrix am
where ar.resourceid=am.resourceid
this returns the following :
ccessid resource_name rolename
1 DepartmentAction Admin
1 DepartmentAction Client
1 DepartmentAction Doctors
2 PositionsAction Admin
2 PositionsAction Client
2 PositionsAction Doctor
the result is wrong and i don't know how to go about.
Ex : DepartmentAction should come only once and the role name should be any one.
SqlfiddleFiddle
Please help