Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Not Sure How To Code This Query
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Titre:
Not Sure How To Code This Query
Divers
Thread ID:
01397296
Message ID:
01397296
Vues:
94
I have Users, Roles, Rights, RoleRights, and UserRights.

I want to pull the rights for a user. So it should first look at the user's Role Rights, then overwrite those rights from the UserRights table:

Here's the table structures:
TABLE: Users
UserId      RoleId      FullName         
----------- ----------- ---------------- 
38          14          Some One
39          15         	Aother Person


TABLE: Roles
RoleId      RoleName      RoleCode
----------- ------------- --------
31          Administrtor  adm
32          Shipping      shp
33          Receiving     rcv


TABLE: Rights
RightId     RightName           RightCode            Access
----------- ------------------- --------------------- ------
10          Login               login                1
11          View Ship Items     vw_shipitems         1


TABLE: RoleRights
RoleRightId RoleId      RightId   Access
----------- ----------- --------- ----------
16          32          10        NULL
17          32          11        NULL


TABLE: UserRights
UserRightId UserId      RightId   Access
----------- ----------- --------- ----------
17          32          11        0
25          33          18        0
I know how to do this with temp tables, but can someone show me how to code this in a query, if it's possible?
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform