Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> ORACLE SQL Gurus...which is faster....
Hi, I have 5 tables:
- user(id/name),
I need: the unique set of commands a specified user has access to. The user can belong to multiple groups, a group is assigned 1 or more commands. Because different groups can be assigned different commands, I know I need either a distinct or exists item.... I figured out the SQL below with "distinct", but any ideas on what a corresponding SQL using "exists" looks like? I am assuming it would be faster ...
Any other performance hints are also appreciated...
Thanks,
Peter
select distinct command_name, user_name, app_name from
crew_user, crew_group, crew_command, crew_application, crew_user_to_group, crew_group_to_command
where
user.USER_Name = 'testUser1'
AND user_to_group.USER_ID = user.USER_ID AND group.GROUP_ID = user_to_group.GROUP_ID AND group_to_command.GROUP_ID = user_to_group.GROUP_ID AND command.COMMAND_ID = group_to_command.COMMAND_ID AND application.APPLICATION_ID = command.APPLICATION_ID
) Received on Tue Apr 16 2002 - 11:38:07 CDT
![]() |
![]() |