SQL to get the user with one or more profiles given names

Hi all!

I have this situation:

I use a table with column user_name

I have a profile_user table that associates profiles user_name. (with columns: user_name, profile)

each user can have 1 or more profiles.


what I need is to find users with profiles that I put in my application

example:

Table profile_user:

Tom, admin
Tom, basic_user
Pat, full_access
John, basic_user
Steve, admin
Pat, basic_user



Let's say I want to know who is (admin and basic_user) or (full_access) for example.

How can I accumulate the query?

Thanks in advance!

Maybe something like that?

SELECT user_name
FROM   table_x
GROUP BY user_name
HAVING COUNT( DISTINCT
              CASE WHEN profile = 'admin'
                     OR profile = 'basic_user'
                   THEN profile
              END
            ) = 2
    OR COUNT( CASE WHEN profile = 'full_access'
                   THEN profile
              END
            ) = 1

If this does not work please see this thread: {message identifier: = 9360002} and display the information mentioned in it.

Tags: Database

Similar Questions

  • I want to play an avi file from Limewire on windows media player and everytime I try I get the error message one or more codecs you need is maybe missing. What should I do?

    I'm having a problem with Windows Media Player 11. I download a file from Limewire 5.3.6 play in wmp, and it won't work at all. I get an error message saying; "Windows media could not read the file. One or more codecs may be missing. I tried to download the codecs and that did not work.

    I'm having a problem with Windows Media Player 11. I download a file from Limewire 5.3.6 play in wmp, and it won't work at all. I get an error message saying; "Windows media could not read the file. One or more codecs may be missing. I tried to download the codecs and that did not work.

    ===================================
    The following free utility can help you identify
    the codec you need.

    Download GSpot
    http://www.free-codecs.com/download/GSpot.htm
    (left-click the text: "Download GSpot")
    (on the next screen...
    left click: 'Download [GSpot 2.70]')

    GSpot Super quick start
    http://www.headbands.com/GSpot/v26x/Quick_Start.html

    Evaluation of video files and Codecs with GSpot
    http://www.windowsmoviemakers.NET/PapaJohn/68/GSpot.aspx

    Good luck.
    John Inzer - MS - MVP - digital media experience

  • Get the data with more than one of the desired value

    Hello

    I need to shoot the records with one value of 'Other' more on delivery days fields.
    Delivery of fields are Mon, Mar, sea, game, Fri and Sam that indicates where the item will be shipped. The value can be at home, work, or other.

    Examples of data include:
    cust_id: 123
    Article: newspaper
    Mon: Home
    Kill: Work
    Sea: other
    game: Home
    Fri: other
    Sam: other


    And here is my request so far.
    Select
    cust_id,
    agenda,
    LUN,
    Mar,
    Kills,
    game,
    Fri,
    Sam
    sum (case when (del_mon = 'o' or del_tue =' o 'or del_wed =' o 'or del_thu =' o 'or del_fri =' o ' or del_sat = 'O') then 1)
    otherwise 0 end) as day_ctr

    of the customer

    Could you please help me with the right formula should I get this?

    Thank you in advance...

    Hello

    This should do it:

    Scott@my11g SQL>with sampledata as (
      2  select 123 cust_id, 'newspaper' item, 'Home' mon, 'Work' tue, 'Other' wed, 'Home' thu, 'Other' fri, 'Other' sat from dual
      3  union all
      4  select 456, 'newspaper' item, 'Home' mon, 'Work' tue, 'Home' wed, 'Home' thu, 'Home' fri, 'Other' sat from dual
      5  )
      6  --#### True query starts here ####
      7  select *
      8  from sampledata
      9  where (
     10  decode(mon,'Other',1,0)
     11  +decode(tue,'Other',1,0)
     12  +decode(wed,'Other',1,0)
     13  +decode(thu,'Other',1,0)
     14  +decode(fri,'Other',1,0)
     15  +decode(sat,'Other',1,0)
     16  )>1 ;
    
       CUST_ID ITEM      MON  TUE  WED   THU  FRI   SAT
    ---------- --------- ---- ---- ----- ---- ----- -----
           123 newspaper Home Work Other Home Other Other
    
  • Get the user logged in PL/SQL

    Hi, I need to get the user name of the user currently connected to the database in PL/SQL.

    I discovered that this can be done by using the following statement:
    select USERNAME into user from v$session where audsid = sys_context('userenv','sessionid');
    The problem is that the above statement will work for a user with privileges higher (if I run it with a user at a disadvantage, I get a table or view is no mistake) and I need to do for any user.

    How can I do this?

    Thank you
    Komyg

    deleted duplicate caused by an error in the forum

    Published by: BluShadow on November 21, 2008 14:01

  • I can't create a shortcut to the site on my desktop, when I click on the url bar I can drag on the browser to open a new, but as I drag him on my desktop I get the circle with the line through it, one that looks like a no entry sign. Help?

    I can't create a shortcut to the site on my desktop, when I click on the url bar I can drag on the browser to open a new, but as I drag him on my desktop I get the circle with the line through it, one that looks like a no entry sign. Help

    Try to drag the image to id web site (favicon) on the left side of the address bar, instead of the URL.

  • Problem with the primary dns server, get the error "There could be a problem with one or more network adapters on this computer."

    Hello

    I was all of a sudden having problems connecting to my wifi at home. When I was diagnosed, he says cannot communicate with primary dns server. I tried all methods in similar positions, but nothing works. I am also unable to connect to internet with my iphone and the itouch. It's really frustrating, because I've already tried all of your suggestions. I just ran another ' diagnose connection problems and it says the following:
    "There could be a problem with one or more network adapters on this computer." Help, please!
    Thank you!

    Thanks for your help, but I have tried this before. In the end I just unplugged my modem and plugged in again and it worked? I feel a bit silly not to try first.

  • Get the user name in the select LOV

    Hello!

    I wonder if its possible to get the user name of the currently logged in user and pass it as a variable in a select statement used in a dynamic LOV in Oracle AS Portal?

    What I'm trying to do is pull all values in a table that corresponds to the current name of user to user on a portal report

    (as an approximate example)

    Select the color from mytable where username = 'whatever is the user name would be here. "

    And then the current user would get a list of values to select based on the values entered in this table.

    The issue I'm having is determine how to complete part "regardless of the user name is would be here" with the actual recorded in user name (or even if its possible). I know that on the portal, we can do #USER. FULLNAME # to display their username, is there a similar "variable", can be used to get the user name for a call to sql LOV?

    I can make it work if I statically resolve the user name to a particular value (ex: where username = "Joe.Hacker"), but I'm not sure if theres value a variable or a bind (for lack of better term) to enter the name of the user on the fly... dynamically.

    Portal.wwctx_api.get_User can be used in your report of Portal SQL query to get the user_name of the currently connected user portal. For more information about wwctx_api, see 10.1.2 portal API documentation or 10.1.4 at http://www.oracle.com/technology/products/ias/portal/html/plsqldoc/pldoc1012/index.html or http://www.oracle.com/technology/products/ias/portal/html/plsqldoc/pldoc1014/index.html

  • Functions defined by the user with several parameters

    I set features three following user using "Define."

    UF1 takes a single patameter;

    UF2 takes two parameters;

    and UFX takes two parameters - with the second is 'X' in the definition.

    Œuvres F1.  F2 is the EVAL of F1 version and it works too.  User functions only seem to work fine.

    F3, a function of two user settings, produces a graph of NaN.

    F4 is the EVAL of F3 version.  Note that 'B 'is not replaced by 1'.  Also produces a NaN chart.

    F5 produces a graph of NaN.

    F6 is EVAL of F5.  The 'X' is not replaced (even with the ' B' above), and even if it looks like 'X * X', it also produces a graph of NaN.

    Is it possible to get defined by the user, with several parameters, features work by tracing the curve?

    Hi!, Fortin:

    If you download and install the ultimate Firmware with the version of the software: 2015 6 17 (8151), with the number of Version: 1.1.2 - 11, you can trace your examples of definition of the function, with curves and values, without NaN.

  • I have seen the user that one of my menu apps start how do I see on the other?

    I installed Microsoft office on my pc but I got 2 users. I have seen the user that one of my menu apps start how do I see on the other?

    Former title: need help please

    Soumya, salvation

    Thanks for posting the query on Microsoft Community.

    If I understand correctly, you want to access the applications in the two accounts on your system.

    When you say "I could see menu start of the user as a single of my apps", are you talking about office applications or other applications?

    For the office, if you are installing Office into the administrator account, it will be copied to all user accounts on its own.

    For other applications, you can consult the links below and check if it helps.

    http://answers.Microsoft.com/en-us/Windows/Forum/windows8_1-security/sharing-apps-on-the-same-Windows-81-computer/11102ceb-4C99-4BB1-81fb-6c9e91b4066d

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_8-windows_store/can-different-local-users-on-a-Windows-8-PC-share/a3d40be6-3504-4e61-8b13-d8f8e5c7bc3b

    I hope this helps to solve the issue. If the problem persists, get back to us. We will be happy to help you.

  • [MAF] How to get the user name and password after login?

    Hi Experts,

    I have a call to REST where it requires identification information of the user (uname and password) to identify the data that belongs to who.

    Authentication has been made with OAuth.

    I believe that there is an API to get the user name and password in the CRG

    See you soon,.

    Hendry

    Hello.

    You don't need to manipulate the credentials yourself in code. MAF will propagate the logon cookie or inject the identification information in the HTTP header if cookies are not supported.

    To do this, you must select the purchase option of cookie from the server connection Include in REST in the dialog box create a connection Login MAF , such as discussed here:

    http://docs.Oracle.com/middleware/maf210/mobile/develop/MAF-securing.htm#ADFMF23732

    In addition, you must attach the policy of security appropriate to the connection, as explained here:

    http://docs.Oracle.com/middleware/maf210/mobile/develop/MAF-Web-services.htm#ADFMF23697

    Best regards

    Frédéric Desbiens

    Senior Product Manager

    Mobility and Cloud oracle

    Twitter: @BlueberryCoder

    blog: http://blogs.oracle.com/blueberry

  • How to get the user name during the execution of a workflow?

    Here's what I would do:

    Say that each user is allowed to have 4 instances QA, create a workflow when a user run from vCenter plugin, it must be able to get the user name of the SSO user jsmith, and then he questions if there is an existing virtual machine jsmith_qa1, jsmith_qa2,jsmith_qa4, etc., if there isn't one, then create one for him; If not, indicate to the user that there are already 4 cases.

    I found that I can use getCurrentLdapUser to get [email protected] , now I want to remove the domain.name (there are several areas):

    username = actionResult.userPrincipalName.replace ("@[a - z].") +","");

    This does not work. Anyone know where I can find the right document for the document script of vRealize Orchestrator?

    Thank you!

    Jack

    vRO uses javascript as its scripting engine.

    UPN var = actionResult.userPrincipalName;

    var username = upn.substring (0, upn.indexOf("@"));

    Something like this will give what you want. You could also do a replacement, but I think that you should remove the quotes around the regex and use "/" instead.

    username = actionResult.userPrincipalName.replace (/ @[a - z] "+ /," "");

    Paul

  • How to get the user directory in HTML5 extension?

    Hello

    It may be too easy as well, but I am running with no luck here.

    I am beginner in developing extensions to HTML5. First time I'm developing InDesign CC extension in HTML5. Before that, I used it to develop in Flex (AS3). SE directory of the user with the AIR API was pretty easy with the File class as: (File.userDirectory.nativePath). But with the HTML5 extension I do not know how to get it with Javascript.

    I tried with two or three ways but no luck.

    I tried:

    var systemPath = new SystemPath();
      alert(systemPath.APPLICATION);
    

    It says no "defined."

    I also tried with a different API:


    var tmpDir = OS.Constants.Path.tmpDir;
    

    It says «Undefined OS»

    Can someone please advise on this?

    Thanks in advance

    Mac

    Try this,

    var csInterface = new CSInterface();

    Alert (csInterface.getSystemPath (SystemPath.user_data));

    You can follow this link,

    http://www.davidebarranca.com/2014/01/HTML-panels-tips-2-including-multiple-jsx/

    Thanks to M. Davide, his advice will help a lot of newbies (whose too)

    It will be useful,

    Best...

    AI

  • How to get the user input to dynamic Action confirmation message?

    Hi guys,.

    I use apex 4.1.

    I added a page dynamic Action confirmation message box. How can I get the user input to the confirmation pop up?

    Thank you

    Hello

    you do not directly get user input. But you should still be able to get what you want. Suppose you have a dynamic action which fires for a 'change' (or other) and who has two or more actions

    (1) confirm
    (2) execute the PL/SQL Code

    If the user clicks Cancel/no in the confirm dialog box, APEX stops execution of this dynamic action and not run "run the Code in PL/SQL.

    Hope that helps
    Patrick
    -----------
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • How to create the file on a location where the user with rights?

    Hello
    I have a requirement in my application a lot of program thatcreating a report to a file and it is written in a user's location. Now he specified directly as (c:\ or d:\...).

    The problem is that the user does not have right to access that directory. What I suggest, or I want to create is special reports on a location where the user with rights.

    Essentially in Windows system % UserProfile % having right to do anyting. Assume that the operating system that is installed in C: the % UserProfile % c:\documents and Settings\nom_utilisateur or D: then D:\Document and user Settings\nom.

    How do I get this help please me.

    Good help will be appreciated.

    Iqbal

    Hello
    The best practice would be to create the file in My Documents for the user currently logged in windows.

    Unfortunately, you did not mention your version of forms. In an older version like 6.x it is function in the library of d2kwutil called Read_Registry in the win_api_environment section, and in the more recent versions the same availble function in the library webutil to client_ name.

    So, you can read the registry database for the current logged in user using the function mentioned above of the location next to the register.
    My Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell folders

    There is an entry named personal. Read the path of this entry when running while generating / record file to the customer's location and save the file in this path.

    -Clément

  • Get the date with the millisecond of the table

    I want to get the date with milliseconds in table format in the variable. How to get there?

    SQL > create table test_date (col1 date);

    Table created
    SQL > insert into test_date values (sysdate);

    1 row inserted

    SQL > commit;

    Validation complete

    SQL > select * from test_date;

    COL1
    -----------
    18/12/2009


    Here I have to get datewith "millisecond" format and put it into the variable varchar2 (50) and pass this
    to Java.


    SQL > select to_char (COL1, ' mm/dd/yyyy hh24:mi:ss. FF') of test_date;

    Select to_char (COL1, ' mm/dd/yyyy hh24:mi:ss. FF') of test_date

    ORA-01821: date format not recognized

    SQL >

    Thank you
    Khaldi

    user601042 wrote:
    I want to get the date with milliseconds in table format in the variable. How to get there?

    SQL > create table test_date (col1 date);

    Your data col1 type should be TIMESTAMP.

    See you soon
    Sarma.

Maybe you are looking for

  • m277dw: m277dw scanning network vs usb connections

    I have my new m277dw put in place with a wired network connection.  All right.  The "scan to network" function works well, but it is pretty basic.   for example, no preview, crop, on mode settings flying, etc..  Does anyone know if direct scanning so

  • I can't get the icons setting or the notification of the Internet

    I can't do the icons for the speakers to open for settings and I don't see the icon that says that I'm connected to the internet

  • ? How to perform an uninstall complete?

    Hey all,. Uninstalled the IOA 1610 and there are files left behind and the service of pml driver was still running. The files that I found so far are: HPZipm12.exeHPZinw12.exeHPZipt12.dllHPZisn12.dllHPZidr12.dllHPZipr12.dll .. .and I dared not even s

  • Difference between packages uc520

    Know you the differences between the "Early Adopter" Version which are available on myciscocommuniuty and the full software pack available on the cisco site? For example:UC520 - 7.1.0 - ea.zip ==> Complete Pack of early adopteur software with all com

  • Network connection diagnostic utility?

    I've heard of the developers Conference that there is a diagnostic utility for network connection available somewhere on the site of the BlackBerry - application developers device BlackBerry that allows you to test communications by using various net