>>>Correction
>>>
>>>select u_id,
>>> u_name,
>>> ur_RoleId,
>>> r_name,
>>> Isnull(MIN(ri_Restriction), 0) as restriction
>>> from @User
>>> join @UserRoles on ( u_id = ur_UserId )
>>> join @Role on ( ur_RoleId = r_Id ) /* this is just to see the drscription of the role */
>>> left join @RoleItems on (ur_RoleId = ri_RoleId )
>>> group by u_id, u_name, ur_RoleId, r_name
>>>
>>>
>>>1 Viv 1 Admin 0
>>>1 Viv 2 User 2
>>>
>>>
>>Hi,
>>
>>Of course you were absolutely right earlier about needing to navigate via UserRoles.
>>
>>>But I don't see where ri_ItemId fits in
>>The RoleItems table links Roles to Items. At the end of the day I want to pass in a user name and Item Id and only get back the lowest restriction (i.e first record in the above example)
>>
>>My head is starting to hurt......
>
>
>
>>My head is starting to hurt......
>
>haha - It took me 2 minutes to see that you needed an outer join, but about half an hour to make the example ( in foxpro it would have taken another rminute or so - have to get used to sqlserver)
>
>
>Good luck - and go out for a walk
Enjoy your walk. I might go for a beer! :-}