I need help in pulling data based on security table, when the user is there in security table then pull data only for that region and security type. below query is working. But for super users all data needs to be pulled and there will not be any record in the security table. How to add superuser in the below query.
(select vendorNo from Vendor V
inner join ( select region,AccessLevel from UserSecurity where userID ='XXX') S
ON S.region = V.region
and ( (S.Accesslevel ='Full' AND V.vendorSecurity IN
OR (S.Accesslevel ='Limited' AND V.vendorSecurity IN ('Unrestricted'))
Thanks in advance.