Can anyone tell me if this union query is possible. I am running MySQL 4.something!
SELECT UserRights.UserRightValue, 'UserRights' as Source, UserRights.UserRight
FROM Users INNER JOIN (UserRights INNER JOIN Users_UserRights ON UserRights.UserRightValue = Users_UserRights.UserRightValue) ON Users.User_ID = Users_UserRights.User_ID
WHERE Users.User_ID = 10
UNION
SELECT DISTINCT UserGroups_UserRights.UserRightValue, 'GroupRights' as Source, UserRights.UserRight
FROM UserRights INNER JOIN (Users INNER JOIN ((UserGroups INNER JOIN UserGroups_UserRights ON UserGroups.UserGroup_ID = UserGroups_UserRights.UserGroup_ID) INNER JOIN Users_UserGroups ON UserGroups.UserGroup_ID = Users_UserGroups.UserGroup_ID) ON Users.User_ID = Users_UserGroups.User_ID) ON UserRights.UserRightValue = UserGroups_UserRights.UserRightValue
WHERE Users.User_ID= 10
ORDER BY UserRights.UserRightValue
SELECT UserRights.UserRightValue, 'UserRights' as Source, UserRights.UserRight
FROM Users INNER JOIN (UserRights INNER JOIN Users_UserRights ON UserRights.UserRightValue = Users_UserRights.UserRightValue) ON Users.User_ID = Users_UserRights.User_ID
WHERE Users.User_ID = 10
UNION
SELECT DISTINCT UserGroups_UserRights.UserRightValue, 'GroupRights' as Source, UserRights.UserRight
FROM UserRights INNER JOIN (Users INNER JOIN ((UserGroups INNER JOIN UserGroups_UserRights ON UserGroups.UserGroup_ID = UserGroups_UserRights.UserGroup_ID) INNER JOIN Users_UserGroups ON UserGroups.UserGroup_ID = Users_UserGroups.UserGroup_ID) ON Users.User_ID = Users_UserGroups.User_ID) ON UserRights.UserRightValue = UserGroups_UserRights.UserRightValue
WHERE Users.User_ID= 10
ORDER BY UserRights.UserRightValue