the query - 2 tables, the user id help

Here's my situation...

have 2 tables.

Table 1 = users
Table 2 projects =


IM selection of several columns in table 2 as project name, project id, etc...
Table 2 contains several columns that store user IDs,
I want to get the user name in table 1 for each id in table 2 (they will be different from the ID in table 2)

so... example...

Select a.projectname, a.projectid, a.user_id_1, a.user_id2, a.user_id2, b.user (each will be a different user id)
projects a, b of users
where user_id_1 = b.user_id (that takes care of user_id_1)
but now how can I get the username for the other user id?

Jay wrote:
CREATE TABLE 'USERS '.
(
USER_ID VARCHAR2 (15 BYTE) NOT NULL,
VARCHAR2 (150 BYTE) USER_NAME
);

CREATE TABLE 'PROJECTS '.
(
PROJECT_NAME VARCHAR2 (500 BYTE),
VARCHAR2 (15 BYTE) PROJECT,
CREATED_BY_USER_ID VARCHAR2 (15 BYTE),
UPDATED_BY_USER_ID VARCHAR2 (15 BYTE),
MODIFIED_BY_USER_ID VARCHAR2 (15 BYTE)
);

Paul - there is also a table that is linked, but this always brings the same problem, I have I need to pull in users 'NAME' for each of the id

IM pullilng data of projects, but it also includes user_ids, and I like to shoot in the user_names of the users table for each user_id of the projects table.
If the final result should be

NAME OF THE PROJECT. PROJECT | USER_ID_1 | USER_ID_2 | USER_ID_3
test project | 12345 | Bob jones | Suzy smith | Steve johnson

Published by: Jay on March 6, 2012 08:23

Ah, now that we see the design of the table, the more sensible multiple user ID, however, what is the difference between "updated by" and "modified by"?

select p.project_name
,        p.project_id
,        uc.user_name
,        uu.user_name
,        um.user_name
from projects p
,      users uc
,      users uu
,      users um
where uc.userid = p.createed_by_user_id
and     uu.userid = p.updated_by
and     um.userid = p.modified_by ...

Tags: Database

Similar Questions

  • Error "cannot load the user's profile.

    user profiles

    Due to a system restore after doing this process when I tried to connect, I get a message "Unable to load the user profile" help please!

    Download the ISO on the link provided and make a record of repair time it starts.

    Go to your Bios/Setup, or the Boot Menu at startup and change the Boot order to make the DVD/CD drive 1st in the boot order, then reboot with the disk in the drive.

    At the startup/power on you should see at the bottom of the screen either F2 or DELETE, go to Setup/Bios or F12 for the Boot Menu.

    When you have changed that, insert the Bootable disk you did in the drive and reboot.

    http://www.bleepingcomputer.com/tutorials/tutorial148.html

    Link above shows what the process looks like and a manual, it load the repair options.

    NeoSmart containing the content of the Windows Vista DVD 'Recovery Centre', as we refer to him. It cannot be used to install or reinstall Windows Vista, and is just a Windows PE interface to recovering your PC. Technically, we could re-create this installation with downloadable media media freely from Microsoft (namely the Microsoft WAIK, several gigabyte download); but it is pretty darn decent of Microsoft to present Windows users who might not be able to create such a thing on their own.

    Read all the info on the website on how to create and use:

    http://NeoSmart.net/blog/2008/Windows-Vista-recovery-disc-download/

    ISO Burner:http://www.snapfiles.com/get/active-isoburner.html

    It's a very good Vista startup repair disk.

    You can do a system restart tool, system, etc it restore.

    It is NOT a disc of resettlement.

    And the 32-bit is what normally comes on a computer, unless 64-bit.

    See you soon.

    Mick Murphy - Microsoft partner

  • User Message interface help - table to send to the user through ActiveX interface

    Hello

    I asked a similar question before, but now I'm having problems trying to get a table in the user interface via the mail user interface. I am my code TestStand, I have an expression to send a picture that is as a container of table of FileGlobal to the UI as such:

    RunState.Thread.PostUIMessageEx (UIMsg_UserMessageBase + 2, 0, "", FileGlobals.DataRead, False)

    and in the UImessage callback I what I thought, I have to do to send the data to an array of text on the user interface. It does not work.

    Can someone tell me what I am doing wrong?

    Is attached, the UIcallback, a picture of the table on my user interface and control


  • How to value all the sequence all the table schema/user

    Hello

    I use the Oracle 11 g server. I have a table close to 100. I want to know all the current sequence value ("Currval")
    of all the paintings in particular schema/user

    Please help me how can I get with this query

    Thanks in advance
    karmaya

    nordine B wrote:
    Try this...

    SELECT sequence_name, last_number FROM all_sequences
    where lower(sequence_owner) = '';
    

    HTH
    Vanessa B.

    Published by: Vanessa B December 3, 2012 13:25

    It is not always correct (again that depends on the condition)

    create sequence seq1 cache 100;
    
    SELECT sequence_name, last_number
    FROM all_sequences
    where sequence_name = 'SEQ1';
    
    SEQUENCE_NAME                  LAST_NUMBER
    ------------------------------ -----------
    SEQ1                                     1 
    
    select seq1.nextval from dual;
    
    NEXTVAL
    -------
          1
    
    SELECT sequence_name, last_number
    FROM all_sequences
    where sequence_name = 'SEQ1';
    
    SEQUENCE_NAME                  LAST_NUMBER
    ------------------------------ -----------
    SEQ1                                   101 --"Showing 101"
    
    select seq1.currval from dual;
    
    CURRVAL
    -------
          1 --"CURRVAL is different"
    
  • Access to several tables to the user

    Hi forum members,

    Am an Oracle, PL/SQl newbie. A request came from the customer. There is a database with two other user/schema - ABC and XYZ.

    Each scheme has its own set of tables.

    Now, our customer wants to access (select access only) all tables from a diagram of the ABC XYZ scheme. Now, there are a more than 200 tables in the schema XYZ, where his bulky to run as the same grant the select query again and again. Could someone help me with a query that would do the work at once?

    NB:client connects the two schemas, using only the users of ABC and XYZ.

    Oracle-11 g

    Thank you very much

    Published by: user1128836 on May 18, 2012 02:31

    Hello

    run these instructions with the user that you want to access:

    set linesize 2000 pagesize 999999999 echo off feed off hea off
    select 'GRANT SELECT ON XYZ.'||table_name||' TO ABC;' from user_tables where table_name not like 'SYS_NT%'
    

    You can then copy and run the output.

  • Defined by the user function in query...

    I have included a function defined by the user in the SQL query that gave rise to the query takes a long time.

    Select col1, col2 (col1, col2) fn_userfunction from table where col1 in (values);

    The function calculate some values based on col1 and col2.

    How this improved query performance?

    Concerning
    Jean-Louis

    Hello

    If it was before including quickly, then you must look at the function for the performance. Maybe you can include the function in the SQL code, which makes it faster. Something else may be to put the function in a subquery:

      select col1, col2, (select fn_userfunction(col1, col2) from dual) xxx from table where col1 in (values);
    

    But you should always try to put at least as possible function in SQL. He created above.

    If the query is too slow without the function, then an index on col1 can help, but depends on the data and distribution.

    If you need help with the feature, you must provide the code for the forum. Then, perhaps we can help.

    Herald tiomela
    http://htendam.WordPress.com

  • Query SQL to see User has it that all the resources provided!

    Hi guys,.

    Have a SQL query to find out what resources are provisioned to a particular user?

    Thank you
    Suren

    Hello

    Hope this will help you.

    SELECT distinct usr_login as 'IdM User ID',
    usr_employeeID as "Employee ID"
    usr. USR_FIRST_NAME as "First Name."
    usr. USR_LAST_NAME as 'Last Name,'
    usr_status
    as "State of the user."

    USR_EMP_TYPE as "employee Type.
    obj.obj_name as 'Application resource',
    ost_status as 'State of enforcement resources.

    The OST, Ouedraogo, obj, usr, Olivier
    WHERE oiu.ost_key = ost.ost_key AND obj.obj_key = obi.obj_key AND oiu.usr_key = usr.usr_key
    AND ost_status in ('set' 'Revoked', 'Disabled', 'Configuration')
    AND oiu.obi_key = obi.obi_key
    AND usr_EmployeeID like '11111'

    This query will provide all of the resources to which the user is associated and the State of the resources is 'Set', 'Revoked', 'Disabled', 'Provisioning' status for a particular ID mandatory, I'm not completely sure whether or not I gave the correct table USR employee ID column. Check once and query the DB

  • Problem with the role and the user; the user cannot see the table

    Hello forum,.

    I created a role:

    Enr_service CREATE ROLE;
    GRANT CONNECT TO enr_service;
    GRANT ALL ON tenants TO enr_service;
    GRANT ALL ON enr_service TO user;
    GRANT ALL ON sportsmen TO enr_service;
    GRANT SELECT ON test TO enr_service;

    and also a user:

    CREATE USER ENR1 IDENTIFIED BY password QUOTA UNLIMITED on USERS;
    GRANT enr_service to ENR1;
    ALTER USER ENR1 by DEFAULT ROLE enr_service;
    ALTER USER DEFAULT TABLESPACE USERS ENR1;

    I can connect to the database with this user, but when I try to query a table that has been granted access I get an error message:

    SELECT * ATHLETES;
    ORA-00942: table or view does not exist

    I don't see what I did wrong. Any help is appreciated.

    Sebastian

    user2019788 wrote:
    Hello forum,.

    I created a role:

    Enr_service CREATE ROLE;
    GRANT CONNECT TO enr_service;
    GRANT ALL ON tenants TO enr_service;
    GRANT ALL ON enr_service TO user;
    GRANT ALL ON sportsmen TO enr_service;
    GRANT SELECT ON test TO enr_service;

    and also a user:

    CREATE USER ENR1 IDENTIFIED BY password QUOTA UNLIMITED on USERS;
    GRANT enr_service to ENR1;
    ALTER USER ENR1 by DEFAULT ROLE enr_service;
    ALTER USER DEFAULT TABLESPACE USERS ENR1;

    I can connect to the database with this user, but when I try to query a table that has been granted access I get an error message:

    SELECT * ATHLETES;
    ORA-00942: table or view does not exist

    I don't see what I did wrong. Any help is appreciated.

    Sebastian

    This is probably because ENR1 isn't any table named ATHLETES and he did not qualify the name of the table with the schema name...

  • I'm trying to generate a table of random numbers 30. After each 5 readings a new vi must open and indicate to the user than 5 readings were made. and continue with the generation of the table again.

    because I don't have a sensor now, I am currently generating a table of random numbers 30. After each 5 readings a warning should be given to the user 5 readngs are completed. This cycle must be repeated. the size of the table is 30.

    Please help me, waiting for response as soon as possible.

    Once I have the transducer, I'll take 30 analog samples and then after each 5 smaples this wraning will be displayed din a new VI

    Use a while loop with a delay time representing your sampling interval.

    Use is equal to the count Terminal to see if 4, then 4th iteration = 5th sample.

    Use a box structure. The real deal will only run on the 4th iteration.

    In the case of true place a Subvi with your message of your choice in the front panel. Go to the properties of the VI window and set ' open the front panel when it is called.

    The condition to closing of attention is not given to your description.

    Consider that rather than usign a Subvi to do this, you can use the "dialog box one/two/three button" or "display message" live in the palette "user interface and dialogue."

    Please try it out and send your own VI. Do not provide us with a working solution.

    Kind regards

  • How can I display table 2D tabular on the Panel before the user can delete any subdashboards

    Hi guys and girls.

    It is my first post here, so go easy on me. I promise you that I used my best GoogleFu I before posting here.

    I am a self taught amateur LabView. I worked on a User Interface for my Robot SAGAR. See some of my work so far (girlfriend used as a draft classes, but we have both worked together on it, which got hooked me in the first place on LV):

    Now, I'm working on the use of LV and Google Earth as a planner of mission right now.

    My question is this. I have a 2D array that stores the Lat/Lon each waypoint. I's like to have posted on my

    front tabular, with WP # (the 1st dimension array index), Lat and Lon on line, like this.

    More importantly, have the user can select a point of full path (or just the number of WP would be ok) and remove it using key DELETE or any other button on the Panel.

    I am at a loss on how to do it. Ideas?

    Thanks for the help!

    Heal the little robot.

    You said that you were using a table. I suggest using a multicolumn listbox. In this way, you can change the selection mode to "highlight the whole line. You can use a structure of the event to respond to the user by pressing the delete key. See attached simple example. Note that some keyboard can label the BACKSPACE key as 'delete '. If you want to answer it, you also have to see if the Char value is 8, which is the code for this key.

  • Somehow, I blocked my user account (login) and I tried to help but can't find any info. How to UNLOCK the user account. Than k you

    The user has clicked on Vista, the little lock at the bottom of the START window.

    Somehow, I blocked my user account (login) and I tried to help but can't find any info. How to UNLOCK the user account. Thank you

    Hello

    Click the account icon that was locked and enter the password IF you know and otherwise:

    Try Safe Mode - several times, press F8 that you start. The Admin account there is no default password
    so unless someone has changed, you should have access there. Then Control Panel - accounts - users
    Manage another account - use this down your user account (to the lowest level) APPLY/OK
    then go back and reset it to the Admin APPLY/OK - this clearly allows corruption. Do this several times.
    Then fix the password in your usual account. Do not forget to leave your account administrator if you
    wish.

    If no joy Mode without failure:

    Try this - use the hidden administrator account to lower your user account (to the lowest level) APPLY/OK
    then go back and reset it to the Admin APPLY/OK - this clearly allows corruption. Do this several times.
    Then fix the password in your usual account. Do not forget to leave your account administrator if you
    wish.

    Make another Admin account with your password and use it to fix the others if necessary. (just for
    repair, don't use regular account, not a safety valve) always keep a spare ADMIN account.

    DO NOT LEAVE THE ENABLED LSA OR USE DAILY. If it corrupts you are toast!

    How to enable or disable the real built-in Administrator account in Vista
    http://www.Vistax64.com/tutorials/67567-administrator-account.html

    You can run the Admin account hidden from the prompt by if necessary.

    This tells you how to access the System Recovery Options and/or a Vista DVD
    http://windowshelp.Microsoft.com/Windows/en-us/help/326b756b-1601-435e-99D0-1585439470351033.mspx

    If you cannot access your old account, you can still use an Admin to migrate to another (do not forget to always
    not that an Admin account that is not used except for testing and difficulty).

    Difficulty of a corrupted user profile
    http://windowshelp.Microsoft.com/Windows/en-AU/help/769495bf-035C-4764-A538-c9b05c22001e1033.mspx

    ---------------------------------------------------------

    If necessary:

    Ophcrack is a free Windows password cracker based on rainbow tables.
    http://Ophcrack.sourceforge.NET/

    How to reset a Windows Vista - Trinity Rescue Kit method - password password reset disc - burn the ISO
    http://www.WikiHow.com/reset-a-Windows-Vista-password
    YouTube video on the use of the Trinity rescue Kit
    http://www.YouTube.com/results?search_query=Trinity+rescue+Kit&search_type=&AQ=f

    Reset your forgotten password the easy way using the Ultimate Boot CD for Windows
    http://www.howtogeek.com/HOWTO/Windows-Vista/reset-your-forgotten-password-the-easy-way-using-the-ultimate-boot-CD-for-Windows/

    Offline NT Password & Reset Editor
    http://home.eunet.no/~pnordahl/ntpasswd/

    I hope this helps.
    Rob - bicycle - Mark Twain said it is good.

  • Relational table between the user and UD_ADUSER profile

    Hello

    I have a requirement where in I need to write a query to find out the difference between user profile for a particular user data and the form data from the same user AD process in Oracle Identity Manager 11g R2 (11.1.2.0)

    While the details of the user are stored in usr table, the table of process for AD shape is UD_ADUSER table. By comparing the two tables, I find the common attribute to be orc_key in UD_ADUSER and ORC table contains the usr_key and table orc_key / usr the usr_key.

    Is ORC table the proper relational table between usr and UD_ADUSER tables to link users between these two tables usr and UD_ADUSER?

    Please correct me if I'm wrong.

    -Thank you,

    def.

    You can use these two tables. I always spend Ouedraogo table between them because the OST has the status of a resource. You can query between them.

    -Kevin

  • Pagination of the table in a query with table Panel

    Hello

    I need to implement paging in a table as long as the results of a query which makes the user, the table that the query is run has several records, 40000 or more.

    I searched but I can't find a way to apply what I, some links show me how to insert the pagination on the part of the table, but if I only do when I want to see a different page, let's say 500 or 1000, it takes too long to display the data of that specific page. I'm guessing it will retrieve all the data from the query and read it all so it can show what I want.

    Another way is to control the amount of data to be returned from the view object (VO), but I am unable to perform paging efect component table in my file jspx somehow.

    I think I should change my VO both my component so I can get the effect I want, but I don't know how. Properties that I need to change to achieve this.

    THK

    If I set the af: non paginated table mode the number of pages do not appear.

    Then maybe you can use the code from this blog to do it manually:

    http://www.Ateam-Oracle.com/adventures-in-WebCenter-skinning-aftable-with-custom-pagination/

    The only optimization that I think is missing is somehow when I select the page from the list of results, will retrieve only the data on this page.

    Yes and for this you must range Paging in VO (so the result of the query may be limited by the size of the range).

    But, as I mentioned in my first reply, range of paging is bug in 12.1.3 then maybe the same applies to 11.1.1.7

    Dario

  • Get the updated record the last based on the Date and the van of the user ID corresponding (multiple tables)

    Hello people,

    I currently have a working for this using PL/SQL solution, but it would be nice to have it using SQL. Any help is appreciated and once again, to your practice time.

    I'm looking to pick up the most recent date and the corresponding user that updated registration for a student in particular. There are two tables T1 and T2. The most recent date can be the create_date or modified_date of T1 or T2.

    Scripts for creating the table and INSERT statements:

    create table T1
      ( code           varchar2(4),
        create_date    date,
        create_userid  varchar2(20),
        modified_date  date,
        modify_userid  varchar2(20));
    
    create table T2
      ( code           varchar2(4),
        visit_id       number,
        visit_date     date,
        create_date    date,
        create_userid  varchar2(20),
        modified_date  date,
        modify_userid  varchar2(20));
    
    

    insert into T1 values ('1001',to_date('06-FEB-2013 09:12:12','DD-MON-YYYY HH24:Mi:SS'),'ROGER',to_date('12-APR-2013 13:01:12','DD-MON-YYYY HH24:Mi:SS'),'BRIAN');
    insert into T2 values ('1001',1,to_date('10-JAN-2013','DD-MON-YYYY'), to_date('10-JAN-2013 14:12:12','DD-MON-YYYY HH24:Mi:SS'),'ROGER',to_date('12-MAR-2013 12:01:06','DD-MON-YYYY HH24:Mi:SS'),'AMY');
    insert into T2 values ('1001',2,to_date('31-JAN-2013','DD-MON-YYYY'), to_date('12-MAY-2013 16:11:12','DD-MON-YYYY HH24:Mi:SS'),'GRACIE',null,null);
    
    insert into T1 values ('1002',to_date('12-JAN-2013 11:12:13','DD-MON-YYYY HH24:Mi:SS'),'LYNNELLE',to_date('12-APR-2013 13:01:12','DD-MON-YYYY HH24:Mi:SS'),'BRIAN');
    insert into T2 values ('1002',1,to_date('10-JAN-2012','DD-MON-YYYY'), to_date('10-JAN-2012 09:12:12','DD-MON-YYYY HH24:Mi:SS'),'ROGER',to_date('12-APR-2013 13:04:12','DD-MON-YYYY HH24:Mi:SS'),'AMY');
    insert into T2 values ('1002',2,to_date('10-JAN-2013','DD-MON-YYYY'), to_date('12-JAN-2013 11:12:13','DD-MON-YYYY HH24:Mi:SS'),'JOHN',null,null);
    
    insert into T1 values ('1003', to_date('04-FEB-2014 12:01:01', 'DD-MON-YYYY HH24:Mi:SS'), 'LYNNELLE', null, null);
    
    

    I want to show for the three codes are the following records:

    Code      Table Date                              User ID
    1001      T2  12-MAY-2013 16:11:12   GRACIE
    1002      T2 12-APR-2013 13:04:12   AMY
    1003 T1 04-FEB-2014 12:01:01 LYNNELLE
    
    

    1001 students, the most recent is the create_date of the visit count = 2 for the Code 1002, the most recent date comes from modified_date for visit 1 (its 3 seconds later than the T1 modified_date). Finally, for students 1003 (who did not all records in T2, the create_date is the only date and must be picked up.

    Thanks in advance.

    with t as)

    Select the code,

    NVL (MODIFIED_DATE, create_date) dt.

    case nvl (modified_date, create_date)

    When modified_date then modify_userid

    of other create_userid

    end userid,

    Tbl "T1".

    from t1

    Union of all the

    Select the code,

    NVL (MODIFIED_DATE, create_date) dt.

    case nvl (modified_date, create_date)

    When modified_date then modify_userid

    of other create_userid

    end userid,

    Tbl 'T2 '.

    the t2

    )

    Select the code,

    Max (TBL) keep (dense_rank last order by dt, tbl) tbl.

    Max (DT) dt,

    Max (UserID) keep (dense_rank last order by dt, tbl) userid

    t

    Code group

    order by code

    /

    CODE TO DT USERID
    ---- -- -------------------- --------------------
    1001 T2 MAY 12, 2013 16:11:12 GRACIE
    1002 T2 12 APRIL 2013 13:04:12 AMY
    1003 T1 4 FEBRUARY 2014 12:01:01 MANON

    SQL >

    SY.

  • Expdp unable the aud$ table as the user sys

    Hello
    Oracle 11 g 2
    OS: Solaris

    Expdp unable the aud$ table as the user sys

    Audit tables is size: 5 GB to check tablespace

    Error details:

    Current estimation using BLOCKS method...
    Total estimation using BLOCKS method: 0 KB
    ORA-39166: Object SYS. AUD$ has not been found.
    ORA-31655: no data or metadata of objects selected for employment

    Export is suspended for 4 hours and shows 0kb of dumpfile to the os levl.

    kindly, one please help on this issue.

    Thank you
    visu.

    try to export the table SYS. AUD$ using the traditional export...

    $exp system / file yourdmpfile.dmp log = yourlogfile.log = tables = sys.aud$

    Please see below notes for more information.
    DBMS_AUDIT_MGMT to manage and purge Audit information [ID 731908.1]

Maybe you are looking for

  • Problem with my Yahoo sign in emails with Firefox.

    When I use FF to connect to my Yahoo email account. It takes my sign etc, but a popup ads appear then got download IE8. You can't get beyond the contextual advertising in your mail...When I use chrome, I can connect to my Yahoo email account with no

  • DeskJet 1050: Deskjet 1050 slow printing

    Given that I have installed the printer software 1050 10 windows did not have the following problems: when I print a document feeds the paper, the printer then does nothing for a while, then part of prints, prints, stalls, stalls... the document is f

  • How to call LabVIEW8.5 DLL VB6.0?

    1: I use an example of which IS here http://zone.NI.com/DevZone/CDA/EPD/p/ID/3990 However, when it is executed, it gives this error: Could not locate the LabVIEW runtime engine. testnum requires a version6.0 (or compatible) LabVIEW Run-time Engine.Pl

  • Print in draft mode (also called EconoMode on my HP printer) on Windows 7?

    On Windows 7, how can I change the printing preferences for print mode/EconoMode project? My printer is HP LaserJet P2015 and I was able to print in EconoMode on Win XP.Now the "printer properties" look very different on Win 7 and I am unable to find

  • The Officejet 7140xi will work with Windowds 7?

    A friend has offfered me an old HP Officejet 7140xi All - in - One Printer.  I need a document scanner.  It will work with Windows 7, or do I have to install Windows XP on my old laptop?