Re: Help with Unmatch Query
- From: John Spencer <spencer@xxxxxxxxxx>
- Date: Thu, 17 Apr 2008 09:52:33 -0400
Three query method
Query One: Your current query
SELECT Profile.Department, Profile_Privilege_Reference.Profile_Name,
Profile_Privilege_Reference.Job_Type,
Profile_Privilege_Reference.Privilege_Name
FROM Profile_Privilege_Reference INNER JOIN Profile ON
Profile_Privilege_Reference.Profile_Name = Profile.Profile_Name
ORDER BY Profile.Department, Profile_Privilege_Reference.Profile_Name,
Profile_Privilege_Reference.Privilege_Name;
Query two: Build a list of ALL possible combinations
SELECT P.Department, R.Profile_Name, R.Job_Type, R.Privilege_Name
FROM Profile as P, Profile_Privilege_Reference as R
Query Three:
SELECT Q2.*
FROM QueryTwo as Q2 LEFT JOIN QueryOne as Q1
ON Q2.Department = Q1.Department
AND Q2.Privilege_Name = q1.Privilege_Name
WHERE Q1.Department is Null
If needed that could probably be built all into one query. Also this query may not be updatable. If you need the ability to update records post back and I will try to come up with a solution for that
'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
Lori wrote:
In Access 2000 I have 3 tables: Profile, Privilege, and Profile_Privilege_Reference. I created a query below that lists the privileges for each profile by department. Department is stored in the Privilege and Profile tables..
I need to create a query that lists the privileges from the privilege table that each profile does NOT have assigned in the profile_privelege_reference, by department. I need the opposite of the query below:
SELECT Profile.Department, Profile_Privilege_Reference.Profile_Name, Profile_Privilege_Reference.Job_Type, Profile_Privilege_Reference.Privilege_Name
FROM Profile_Privilege_Reference INNER JOIN Profile ON Profile_Privilege_Reference.Profile_Name = Profile.Profile_Name
ORDER BY Profile.Department, Profile_Privilege_Reference.Profile_Name, Profile_Privilege_Reference.Privilege_Name;
Thanks for any help!
- Follow-Ups:
- Re: Help with Unmatch Query
- From: Lori
- Re: Help with Unmatch Query
- References:
- Help with Unmatch Query
- From: Lori
- Help with Unmatch Query
- Prev by Date: Re: Refining query
- Next by Date: Re: Calculation in Query
- Previous by thread: Help with Unmatch Query
- Next by thread: Re: Help with Unmatch Query
- Index(es):
Relevant Pages
|
Loading