selecting across multiple tables to check permission

Posted on 2008-11-01
Last Modified: 2012-05-05
I have a series of tables



and then i have users


and then finally which districts the users can view


I want to get a list of all people but only people that belong to offices which are in districts that I as a user can see. A user may see multiple districts.
Question by:phenixfilms
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 125 total points
ID: 22858847
you mean:
select p.strName, o.strName office_name
  from userdistrict ud
  join office o
    on o.nDistrictID = ud.nDistrictID
  join people p
    on p.nOfficeID =
where id.nUserID = 1234  <<<-- the user you are querying for

Open in new window


Author Comment

ID: 22858885
What about the user? I see your selecing WHERE id.nUserID.... but you've never set id to be a table or anything.

LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 22858920
that should have been ud.nUserID instead of id.nUserid ...
ud being the table alias of userdistrict.

I assume that you want to query for 1 single user...

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question