tblUser
| UserId | Username | Password |
| 1001 | Dorothy | 12345 |
| 1001 | Jane | 78965 |
tblRole
| RoleId | RoleDescription |
| 1111 | Administrator |
| 1112 | Floor Manager |
| 1113 | Sales Director |
tblUserRolelink
| UserId | RoleId |
| 1001 | 1111 |
| 1001 | 1113 |
| UserId | Username | Password |
| 1001 | Dorothy | 12345 |
| 1001 | Jane | 78965 |
| RoleId | RoleDescription |
| 1111 | Administrator |
| 1112 | Floor Manager |
| 1113 | Sales Director |
| UserId | RoleId |
| 1001 | 1111 |
| 1001 | 1113 |
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
DorothyPosted Nov 21, 2006, 1:14 AM
solution and it worked perfectly.
Kheen On CheahPosted Nov 16, 2006, 7:46 PM
DorothyPosted Nov 16, 2006, 7:48 AM
I had the similar select statement but it keeps on returning positive even if the user logged in doesn't have admin rights...Unless there's another method.
From Role r, User u, UserRoleLink sys Where r.RoleId = sys.roleId AND u.UserId = sys.UserId AND r.RoleDesc = 'Managing Director'Select r.RoleId, u.UserId, sys.RoleId, sys.UserId
Kheen On CheahPosted Nov 16, 2006, 5:18 AM
try
select
A.Username
, C.RoleDescription
from
tblUser A
, tblUserRolelink B
, tblRole C
where
B.UserId = A.UserId
and C.RoleId = B.RoleId
and A.Username = xxxx
;
fangza lroPosted Nov 16, 2006, 4:06 AM
where u.Username=xxx and u.Password=xxx
Is this SQL sentence OK?