Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Company have many office and each office have many user and user link with roles and role link with permissions.
Can any one tell me if i get all the data in one query or get user data first then get the roles permission after login.Which method is fast get whole data in one query or get only first user data the rest data

What I have tried:

select * from company join office on Company.ID=Office.CompanyID
Join User on Office.ID=User.OfficeID
Join UserRole on User.ID=UserRole.UserID
Join Role on Role.ID=UserRole.RoleID
Join RolePermission on Role.ID=RolePermission.RoleID
Join Permission on RolePermission.PermissionID=Permission.ID
where userID="" AND password=""
Posted
Comments
Richard Deeming 10-Aug-16 13:53pm    
Don't store passwords in plain text. You should only ever store a salted hash of the user's password, using a unique salt per record.

Secure Password Authentication Explained Simply[^]
Salted Password Hashing - Doing it Right[^]
RossMW 10-Aug-16 15:38pm    
What is wrong with the result of your query you have tried. We cant see your tables so are not sure what it should be.

You probably need to also check out http://www.sql-join.com/[^] to see different join types

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900