Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with view syntax
Message
From
03/10/2009 09:35:58
 
 
To
03/10/2009 09:31:15
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Application:
Desktop
Miscellaneous
Thread ID:
01427486
Message ID:
01427499
Views:
33
>>>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! :-}
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform