January 30, 2008 at 6:11 am
Dear All,
I have a two table Users && Roles
Roles contains following columns
Roleid, Rolename,InboxEnabled
Users contains
Userid,Region,Branchid,Roles
The Data in the Roles Table is
Admin -Admin -y
Enduser-EndUser-n
Dev -Developer-y
Network-Network-y
The data in the users table is
Ravi-North-Delhi-Admin,Dev,Network,
Raju-North-Delhi-Dev,Enduser,
select Roleid from Roles where Inboxenabled ='y' will return me Admin and Dev roles
when i pass this query as a condition to users table i have to get output as Ravi
Anyone please help me to solve this query
i
January 30, 2008 at 6:39 am
Please don't cross-post. Especially don't post things in the 2008 forums that has no relation to 2008.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
May 23, 2008 at 3:54 am
Hi Prakash,
Have you analysed your Condition before posting ,it is not possible to select only ravi because you have given Inboxenabled for Admin,Dev as Y,
How can the query select based on this condition Ravi only
First analyse and then post it and it will be better if you post as like below format
Here is my result
create table Roles(Roleid varchar(20), RoleName Varchar(20),InboxEnabled Varchar(20))
create Table Users(Userid varchar(20), Region Varchar(20), Branchid Varchar(20),Roles Varchar(20))
insert into users
select 'ravi','northDelhi','Admin','Network' union
select 'raju','northDelhi','dev','enduser'
insert into Roles
select 'ADmin','admin','y' union
select 'Enduser','EndUser','n' union
select 'Dev','Developer','y' union
select 'Network','Network','y'
select userid from users where Branchid in (select Roleid from Roles where Inboxenabled ='y')
rajesh
June 12, 2008 at 7:45 am
I think Grant is Correct..
Only SQl Server 2008 Post should be placed here..
so we can able to analyzes more on Sql Server 2008..
before going to implements sql 2008 in our developments server..
Cheers!
Sandy.
--
July 21, 2008 at 6:11 am
select userid from users where Branchid in (select Roleid from Roles where Inboxenabled ='y')
July 21, 2008 at 8:25 pm
Grant Fritchey (1/30/2008)
Please don't cross-post. Especially don't post things in the 2008 forums that has no relation to 2008.
Heh... well that worked well... wanna borrow some porkchops? 😛
--Jeff Moden
Change is inevitable... Change for the better is not.
July 21, 2008 at 8:53 pm
Jeff Moden (7/21/2008)
Grant Fritchey (1/30/2008)
Please don't cross-post. Especially don't post things in the 2008 forums that has no relation to 2008.Heh... well that worked well... wanna borrow some porkchops? 😛
Hmmm, seems someone decided to post an answer to a post 6 months old. And, to a post that was a cross-post and noted as cross-posted.
Yeah - I think Grant needs to borrow some porkchops...;)
But, can you save some for me - I have a strong feeling I am going to need them real soon :w00t:
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
July 22, 2008 at 5:24 am
So what do I do with these pork chops? Sharpen the bones & throw 'em like a boomarang?
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
July 22, 2008 at 6:22 am
Now that's an interesting use... I normally just use an inner tube sling shot with a foot wide maw on it.
--Jeff Moden
Change is inevitable... Change for the better is not.
July 22, 2008 at 6:24 am
Oh, I've got one of those for the dog... it'll work.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
July 23, 2008 at 11:54 pm
😉
--
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply