I have a select statement for a menu control that I need to join to another table to allow permission dynamically
I am using a CTE select.
now my appid are the different menu categoryies that will display the menu.
select * from
row_number() over (partition by a.Title, a.Url, a.Description order by ParentId, OrdinalPosition, Title) rn
FROM Users u
JOIN UserGroup_new ug ON u.UserKey = ug.UserKey
JOIN GroupApplications_test ga ON ug.GroupID = ga.GroupID
JOIN site_SiteMap_beta a ON ga.AppID = a.AppID
WHERE u.UserID = @UserID
where rn = 1
ORDER BY ParentId, OrdinalPosition, Title
Now I have another table I need to join to my current select statement
FROM LCustomer where Customer = @UserID
What I need to put together if loyalty = '0' then in the select appid 17 will not be selected.
if loyalty is 1 then select appid 17
how can i join what I have now with the select statment above. Not sure of the best method to accomplish this.