Hi All,
Well the problem in short is merging rows based on some priority .
My First Table Structure is Name is User_Security
User_Name varchar
User_Group Varchar
My Second Table Structure is Name is Screen_Security
User_Group Varchar
Screen_id varchar
Read/Write integer value either 1/0
Read integer value either 1/0
Disable integer value either 2/0
Now the actual problem is
A User may be in different groups and suppose X user is in Y and Z group then when i select my query based on user name from second table i get No of Screens * No of groups a user belongs
instead i want to merge the records which has identical screen ids
based on priority like this
Read/Write > Read > Disable
if there is Read/Write right for any group the user belongs then for that particular screen that should be his rights irrespective of any other rights and if he has Read and Disable but no Read/Write then Read should be returned else it should be Disable.
Another point to note is if there is a read/write right then that field is marked 1 else 0 same for read but for disable it is 2 if present else 0.
Can Any one suggest how to get this in single query
Thanks
ItsSree
Well the problem in short is merging rows based on some priority .
My First Table Structure is Name is User_Security
User_Name varchar
User_Group Varchar
My Second Table Structure is Name is Screen_Security
User_Group Varchar
Screen_id varchar
Read/Write integer value either 1/0
Read integer value either 1/0
Disable integer value either 2/0
Now the actual problem is
A User may be in different groups and suppose X user is in Y and Z group then when i select my query based on user name from second table i get No of Screens * No of groups a user belongs
instead i want to merge the records which has identical screen ids
based on priority like this
Read/Write > Read > Disable
if there is Read/Write right for any group the user belongs then for that particular screen that should be his rights irrespective of any other rights and if he has Read and Disable but no Read/Write then Read should be returned else it should be Disable.
Another point to note is if there is a read/write right then that field is marked 1 else 0 same for read but for disable it is 2 if present else 0.
Can Any one suggest how to get this in single query
Thanks
ItsSree