Please help

  • 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

  • select Roleid from Roles where Inboxenabled ='y' will return me Admin and Dev roles

    According to the data you supplied, the query should return Admin, Developer and Network. In the 'WHERE' clause, besides Inboxenabled = 'Y', is there anything else ?

  • It's not quite clear what you want. your query doesn't reference users at all.

    This almost seems like homework. Please make an attempt against users and show what is confusing or not working and we're happy to help.

  • In the Roles table, 'Developer' has a 'Y' in the InboxEnabled field.

    So if you select user from the Users table where InboxEnabled = 'Y' in the Roles table, how come only 'Ravi' returned? User 'Raju' has 'Developer' too.

  • Please don't cross post. It wastes people's time.

    Please direct replies to the following thread:

    Please help (SQL2K5)

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply