Need help with the query using the aggregation

If I have a table, defined as follows:

CREATE TABLE range_test
(
range_id NUMBER (20) NOT NULL,
rank of char (1) NOT NULL,
lower_bound_of_range NUMBER (5.2) NOT NULL,
upper_bound_of_range NUMBER (5.2) NOT NULL,
received_date_time_stamp SYSTIMESTAMP NOT NULL DEFAULT TIMESTAMP
);

And I wanted to query the table to find the range associated with the last line inserted for each 'class' (for example 'A', 'B', 'C', etc.), how would I go about this?

I want something like the following, but I know that it will not work right:

SELECT
grade,
lower_bounding_of_range,
upper_bounding_of_range,
Max (received_date_time_stamp)
Of
range_test GROUP BY received_date_time_stamp;

Thanks for your help... I am frustrated with this one and I think that it should be possible without having to use the PL/SQL (i.e. the functions of SQL aggregation or subqueries should work).

Perhaps something along the lines of...

SQL> ed
Wrote file afiedt.buf

  1  select deptno, empno, ename, hiredate
  2  from emp
  3* order by deptno, empno
SQL> /

    DEPTNO      EMPNO ENAME      HIREDATE
---------- ---------- ---------- --------------------
        10       7782 CLARK      09-JUN-1981 00:00:00
        10       7839 KING       17-NOV-1981 00:00:00
        10       7934 MILLER     23-JAN-1982 00:00:00
        20       7369 SMITH      17-DEC-1980 00:00:00
        20       7566 JONES      02-APR-1981 00:00:00
        20       7788 SCOTT      19-APR-1987 00:00:00
        20       7876 ADAMS      23-MAY-1987 00:00:00
        20       7902 FORD       03-DEC-1981 00:00:00
        30       7499 ALLEN      20-FEB-1981 00:00:00
        30       7521 WARD       22-FEB-1981 00:00:00
        30       7654 MARTIN     28-SEP-1981 00:00:00
        30       7698 BLAKE      01-MAY-1981 00:00:00
        30       7844 TURNER     08-SEP-1981 00:00:00
        30       7900 JAMES      03-DEC-1981 00:00:00

14 rows selected.

SQL> ed
Wrote file afiedt.buf

  1  select deptno, empno, ename, hiredate
  2  from (
  3        select deptno, empno, ename, hiredate
  4              ,row_number() over (partition by deptno order by hiredate desc) as rn
  5        from emp
  6       )
  7  where rn = 1
  8* order by deptno, empno
SQL> /

    DEPTNO      EMPNO ENAME      HIREDATE
---------- ---------- ---------- --------------------
        10       7934 MILLER     23-JAN-1982 00:00:00
        20       7876 ADAMS      23-MAY-1987 00:00:00
        30       7900 JAMES      03-DEC-1981 00:00:00

SQL>

Tags: Database

Similar Questions

  • I need help with the program of Photos on my macbook pro

    I use a Macbook Pro with OS of Yosemite. I really need help with the Photo program. I never really got the hang of IPhoto and now that it's a new program, I'm really confused. Where can I go to learn this without waiting for the next workshop in a local store?

    Hi, I'm fighting to open same mine, making a new software update

  • Need help with the launching track pack for forza code 4

    Bought new Forza 4 and the lancer Track Pack code does not work, how do I get a code that is generated in the form I've already paid for it. Rank of loads of numbers and sent 10 s of emails but cant seem to get help.

    This is the help I get when the cat to an Ambassador xbox on xbox.com

    Terry wrote:
    Need help with the launching track pack for forza code 4
    The Xbox Ambassador says:
    Location of Ambassador of the community...
    The Xbox Ambassador says:
    Location of Ambassador of the community...
    The Xbox Ambassador says:
    Your question will be answered by an Ambassador of the Xbox. You have been connected to the Ambassador as a user Xbox [3]
    The Xbox Ambassador says:
    Hello
    Terry wrote:
    Hello
    The Xbox Ambassador says:
    Hey
    Terry wrote:
    just to be on the phone to xbox live support and was told to come here
    The Xbox Ambassador says:
    ok\
    The Xbox Ambassador says:
    What is your problem?
    Terry wrote:
    I bought the 4 for forza ansd 360 new sealed Christmas...
    Terry wrote:
    has got 2 codes that accompanies the game but the pack track code does not work
    The Xbox Ambassador says:
    Wow good
    Terry wrote:
    whenever I put in the code it says code redeemed
    The Xbox Ambassador says:
    I think the code is used. You must return to the retailer
    Terry wrote:
    I tried to, but since I already opened the case they will not accept
    The Xbox Ambassador says:
    Oh. No,
    Terry wrote:
    the code had been used or defective as I am the only person who has touched the game once opened, tried to enter the code when it is open
    The Xbox Ambassador says:
    Maybe it was auto bought?
    Terry wrote:
    so, how do I get another code generated track Pack if defective?
    The Xbox Ambassador says:
    I do not know.
    Terry wrote:
    bought the game new, so I get the track pack
    The Xbox Ambassador says:
    Oh. It's bad.
    The Xbox Ambassador says:
    I think that if you Exchange 1 code it will buy it
    Terry wrote:
    car pack code worked, starter pack did not work
    The Xbox Ambassador says:
    Oh.
    The Xbox Ambassador says:
    It's a bad
    The Xbox Ambassador says:
    BTW you have an evolution of the tests?
    Terry wrote:
    Yes, I want to? but more anxious to get a code object generated for this pack
    The Xbox Ambassador says:
    Hey if I help can u give me this game too?
    Terry wrote:
    ?????????????????
    Terry wrote:
    So is it possible to get a code for that time?
    The Xbox Ambassador says:
    Hey
    The Xbox Ambassador says:
    Yes.
    The Xbox Ambassador says:
    you need to contact them
    The Xbox Ambassador says:
    and tell them that the code is used.
    Terry wrote:
    I was told to come here? where can I go to get the code?

    Hi Terryg76,

    ·         What version of the operating system is installed on the computer?

    I suggest you to contact the game manufacturer for more help and information.

  • Need help with the blue screen issue "NAVEXI5. SYS, PAGE_FAULT_IN_NONPAGED_AREA ".

    Original title: need help with the blue screen issue
    My computer turns saying a blue screen: a problem has been detected and windows were shut down to prevent damage. The problem seems to be caused by the following file: NAVEXI5. SYS PAGE_FAULT_IN_NONPAGED_AREA he seems to have a different error whenever he turns to a blue screen. Can someone help me please.

    Hello

    1. Since when are you facing this problem?
    2. you remember to make changes to the system?
    3. do you get an error with this error code?

    I suggest to unplug external devices such as printer, scanner, etc. that are plugged into the system, and then restart the system and check if the problem persists.

    Method 1.
    I suggest you to do a check disk from the recovery console and check if the problem is resolved. Follow the steps mentioned below.
    a. start into the recovery console using the XP CD. Follow the steps mentioned in the article below.
    Description of the Windows XP Recovery Console for advanced users
    http://support.Microsoft.com/kb/314058
    b. perform a disk check.
    How to perform disk error checking in Windows XP
    http://support.Microsoft.com/kb/315265

    Method 2.
    I suggest you to start with the XP CD and then do a system restore. Follow the steps mentioned in the article below.
    How do I recover from a corrupted registry that prevents Windows XP startup
    http://support.Microsoft.com/kb/307545

    I hope this helps.

  • I'm on Acrobat 10 and I need help with the distribution of shape feature. Is there a way to change the registration e-mail download addressed to the? Currently all forms I create and then distribute may only be subjected to my email account... I appreciat

    I'm on Acrobat 10 for mac and I need help with the distribution of shape feature. Is there a way to change the registration e-mail download addressed to the? Currently all forms I create and then distribute may only be subjected to my email account... I appreciate any help!

    Do not use the feature distribute the form. Instead of this, just put up a button "submit" and configure it to send email using any email address you want. Just add a button and set the action of the mouse upward on "Submit a form" and use a type mailto URL and specify that you want to send the full PDF. Then activate the reader of the document: where "Advanced/extended features in Adobe Reader" is located in Acrobat XI?

    If you really want to use distribute the form for some reason, change the e-mail address in your preferences: Edit > Preferences > identity > Email address

  • Hello need help with the opacity mask.

    Hello need help with the opacity mask. I hope someone out there can help

    I inherited a logo that appears to use a Logo of OM has a shape with a grad. This grad at first sight is not used in the Grad scheme and there is not editable.  Looking at the transparency palette I find an OM (pic1) output option. If I choose what the grad on separates it from the page of the form, that is from there I can change/remove as required (Note2).

    However, sometimes (he did no change), I'll be back to the same original form and output option is grayed out and is no longer available. Or I go to the similar shape that has the same treatment and I can't go out OM (pic3)

    The only difference is the thumbnail in the transparency palette, which is strong in pic1 and rated on pic3. What Miss me?    I'm not clear what the advantage is simply OM using the Grad palette to apply a grad in my form, but until I can get rid of OM who is there, I can't comfortably apply to the grad I want.

    The white gradient LHS I have no problem with. I choose fortunately only and each time get the possibility of release of OM.

    Screen Shot 2015-08-06 at 12.26.48.pngScreen Shot 2015-08-06 at 12.00.10.pngScreen Shot 2015-08-06 at 12.01.16.png

    The other thing weird. When I select the white gradient. Sometimes, the exit option is in the palette without going through the drop-down list (Fig 4).

    Other times seems not that OM has already been applied, because the palette gives me the ability to mask rather than liberation (5 photos). Until I go to the drop down and then I find Release is an option after all.

    What is the difference here?   Not much of a problem, because either way I can release OM to be able to change the grad.

    The file is passed through several hands and play anywhere to try to resolve issues, and many stops and save slot, so something along the line was of course done a logo and not the other because of the difference, but I can't for the life of me see what that.

    Screen Shot 2015-08-06 at 12.44.21.pngScreen Shot 2015-08-06 at 12.44.36.png

    I hope someone can help. Very appreciated


    See you soon

    Dave

    Dave,

    I've (mis) understanding the issues, you can account for the box to the right in the main palette transparency (called thumbnail) here.

    Illustrator help | Transparency and blending modes

    represents the masking objects.

    Some of your screenshots show no object mask, so it only is not really a mask even if do the opacity mask has been clicked and there seems to be one in the layers palette, wherever you look.

    I think that it is perhaps the issue.

  • Making the ear of corn and need help with the ball.

    I do some corn on the COB for an illustration and I need help with the texture of the ball. I've been slowly making progress with gradient for kernels mesh, but I can't seem to recreate the look of the ball at all. I tried to recreate it in a rectangle by using the option in the menu object (1 row, 50 columns) gradient mesh and I'm trying with the fusion in object mode, but not lucky yet. Can someone help to put me on the right track to make the texture:

    http://images.clipartof.com/sweet-corn-on-the-cob-with-husk-royalty-free-vegetable-stock-photo-by-kennygadams-4501068853.jpg

    http://image.shutterstock.com/display_pic_with_logo/660550/660550,1298544740,8/stock-photo-ripe-corn-vector-illustration-on-white-background-71847955.jpg

    http://static5.depositphotos.com/1012047/533/v/950/depositphotos_5336961-Corn-oil.-Stylized-drop-of-oil-and-corn-cob..jpg

    I've been slowly making progress with gradient for kernels mesh, but I can't seem to recreate the look of the ball at all.

    Tank,

    You have published three images stylistically very different. The first is photographic and call probably (but not necessarily) for graduates of mesh. The other two are graphical treatments (and frankly, they're both rather flat; lack of depth).

    Illustration style extends the range of cartoonish in sketchy photo-realism and all the rest. The problem is you didn't show your own attempt so that anyone can have an idea of what you're trying to achieve the stylistic point of view.

    I just need to put in place so that the final step does not appear the whole box. The problem now is trying to make the style of the good brush to reproduce the effect...

    You seem to think you have to build a kind of linear construction and then find a way to reshape the shape of each part of the leaf. Yes, you pouvez approach it this way, but Illustrator users has often tend to be what aunt Molly would call "too clever by half."

    Not everything must be something semi intelligent auto or complex and tedious consruct involving brushes, envelopes, masks, etc, etc. Much can be accomplished by thinking that he just thanks to measure you draw directly economic paths and constructions, which take no more time (often less) and result in very tidy, simple files. Again, a lot depends on what you are trying to achieve the stylistic point of view. But here's an example that only took a few minutes to draw:

    If the above consists of:

    Three roads closed, 8 points each, with ordinary linear degrees

    Three mixtures of open path with three anchor points for each key path

    Six paths closed for shadows / highlights, with 19 points in total

    Mixtures being directly from the paths drawn comic forms, the spacing of the veins 'automatically' and intuitively follows the width from point of view of the worksheet.

    Rather than to build a boilerplate brush, colouring and the weight of each of the three main paths of the vein mixtures can be set individually at any time, simply directly by selecting the key path.

    JET

  • I need help with the control of two .swf in third.

    Hi, thanks for reading!

    I need help with the control of two .swf in third.

    I have a problem when I need to use a .swf in a digital signage solution, but were advised by the Legal Department, it cannot be changed in any way, I can not also have the source file blah blah blah. I pulled the .swfs on their site and I decompiled to see what I was up against.

    The main SWF that I need control is HCIC.swf and the problem is that it starts with a preloader, which, after the loading stops on a framework that requires user input to (button) on a play button, until the film will proceed and replay.

    What I've done so far is to create a SWF container, HCIC_container.swf, which will serve as a target for the HCIC.swf and I would like to send actionscript in the file, I am not allowed to edit.

    I managed to get done with help from someone on another forum. It is my hope that the following script just start HCIC.swf a framework after the preloader and button play and just play through.

    var container: MovieClip = createEmptyMovieClip ("container", getNextHighestDepth());
    var mcLoader:MovieClipLoader = new MovieClipLoader();
    mcLoader.addListener (this);
    mcLoader.loadClip ("MCIC.swf", container);

    function onLoadInit(mc:MovieClip) {}
    mc.gotoAndPlay (14);
    }

    But unfortunately it does not solve my problem. Because there is a media - controller.swf, which is charged by HCIC.swf who has orders, including the play button to start HCIC.swf.

    Here is a link to a .zip with all 3 files .swf file and all 3 .fla files.

    http://www.axiscc.com/temp/HCIC.zip

    What I have to do is to automatically start the HCIC.swf file, bypassing the pre-loader and play button without having to edit it or in the media - controller.swf in any case. Thus, all scripts must be done in HCIC_container.swf.

    I know it is confusing and it is difficult to explain, but if you look at the files it must make sense.

    ActionScripting is far from my point hard, so I'm definitely over my head here.

    Thanks for your help.

    Got my solution on another forum.

    http://www.ActionScript.org/forums/showthread.php3?t=146827

  • Need help with the installation of an adapter of Palit GeForce 9500GT Super chart - 512 MB in a M2N68 (narrated

    Need help with the installation of an adapter of graphics Super Palit GeForce 9500GT - 512 MB - DDR2 SDRAM in a M2N68 motherboard (narra6). Should I disable the onboard graphics in the bios? When the card is installed, no VGA work outs and the PC does not start. Checked and recontroler implementation of the card in the PCI slot. PC is a desktop HP G5200uk PC. Windows 7 operating system.

    Hello

    The link below is a guige to install a video card in your Pc.  In particular, it seems that you will have to perhaps specify the location of the new card in the bios and save this change before you install the new card - see step 4 in the guide on the link below.  If your new card fits into the PCI Express x 16 slot, you will need to define PCI Express in the bios and save the changes.

    http://support.HP.com/us-en/document/c01700855

    Kind regards

    DP - K

  • Need help with the IP configuration on vm ware for the installation of 11 GR 2 on linux vmware 6 on win7

    Need help with the ip configuration on/etc/hosts for the installation of 11 GR 2 on linux vmware 6 on win7.

    Let me know if you need more info... in fact I have a setting error while installation said

    -(/ etc/hosts has no correct entry for the host name)

    Host: 192.168.85.100

    Win7 ip: 192.168.1.x

    Thank you...

    (host computer)

    Win7 64 bit

    (vmware)

    Oracle Linux Server 6.3 version

    Release of Red Hat Enterprise Linux Server 6.3 (Santiago)

    Oracle Linux Server 6.3 version

    -(/ etc/hosts has no correct entry for the host name)

    Then post your/etc/hosts.

    Host: 192.168.85.100

    Win7 ip: 192.168.1.x

    Why 85? have you tried 192.168.1.100?

  • need help with the mac version of PES

    need help with the mac version of PES

    If you follow the 7 steps you can dl a trial via the links here: http://prodesigntools.com/tag/ddl

    and activate it with your serial number.

    If you have a problem dl'g, you don't follow all 7 steps.  the most common mistake is not meticulously follow the steps 1, 2, and/or 3 (which adds a cookie to your system, allowing you to download the correct version of the adobe.com site).

    p.s. If you need a more direct link, you must specify the exact version you want.

  • Need help with a query result

    Oracle Version: 11.2.0.2.0

    I need assistance with the output of the query. Here is the table.

    With Tbl_Nm as

    (

    Select 'ABC1' SYSTEM_ID, REGION 'US', 'CHI' SUB_REGION 4000 BALANCE, to_date('1-JUN-2012 10:45:00 am', 'dd-mon-yyyy hh:mi:ss am') LAST_UPD_TIME, 'A' FLAG of union double all the

    Select 'PQR2', 'UK', 'LN', 2000, To_Date('1-JUL-2012 10:46:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' starting from dual Union All

    Select 'ABC1', 'IND","MAMA", 3500, To_Date('1-AUG-2012 11:47:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select "LMN3", "US", "NJ", 2500, To_Date('1-SEP-2012 09:49:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select "PQR2", "UK", "MC", 2600, To_Date('1-OCT-2012 04:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select 'ABC1', 'US', 'NY', 3200, To_Date('1-OCT-2012 06:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' starting from dual Union All

    Select "LMN3", "UK", "BT", 2400, To_Date('1-NOV-2012 07:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' From Dual

    )

    Select * from tbl_nm

    I need the output below.

    PQR2 UK MC 2600 1 OCTOBER 2012 04:45

    ABC1 US NY 3500 October 1, 2012 06:45

    LMN3 UK BT 2500 November 1, 2012 07:45

    The need the disc according to this system_id flagged as "A". But if the last disc of 'd' then it must show that the amount, but the file should be displayed in 'A '.

    I've tried a few and got stuck. Help, please. Not able to get a balance '.

    This question is a bit similar to needing help with a query result

    With Tbl_Nm as

    (

    Select 'ABC1' System_Id, region 'US', 'CHI' Sub_Region, 4000 balance, To_Date('1-JUN-2012 10:45:00 am', 'dd-mon-yyyy hh:mi:ss am') Last_Upd_Time, 'A' flag of double Union All

    Select 'PQR2', 'UK', 'LN', 2000, To_Date('1-JUL-2012 10:46:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' starting from dual Union All

    Select 'ABC1', 'IND","MAMA", 3500, To_Date('1-AUG-2012 11:47:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select "LMN3", "US", "NJ", 2500, To_Date('1-SEP-2012 09:49:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select "PQR2", "UK", "MC", 2600, To_Date('1-OCT-2012 04:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select 'ABC1', 'US', 'NY', 3200, To_Date('1-OCT-2012 06:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' starting from dual Union All

    Select "LMN3", "UK", "BT", 2400, To_Date('1-NOV-2012 07:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' From Dual

    )

    Select System_Id, region, Sub_Region, Balance, Last_Upd_Time of Tbl_Nm T1

    where t1. Last_Upd_Time = (select max (Last_Upd_Time) in the Tbl_Nm T2 where T1.) SYSTEM_ID = T2. SYSTEM_ID)

    So maybe you'd then

    ORDER BY DECODE(flag,'D',9,1) ASC...

    to get the Ds at the end of the list.

    or

    ORDER BY CASE WHAT flag = has ' (your other filters) AND then 9 or 1 end CSA,...

    HTH

  • need help with the query, thx

    Hello
    I need a little help with the query I have to write;
    the table has 4 columns:
    col1               col2         col3       col4
    emp_name     empl_id    salary      year
    
    content of data:
    
    col1               col2         col3       col4
    smith             12           1200      1999
    smith             12           1340      2000
    smith             12           1500      2001
    jones             13           1550      1999 
    jones             13           1600      2000
    aron              14           1200      2002
    what I am asking is the following result: salary according to the latest available year
    i.e.
    smith         12         1500        2001
    jones         13         1600        2000
    aron          14         1200        2002
    ID appreciate some guidance on how to achieve
    Thank you
    Rgds
    select *from
    (select col1, col2,col3, col4,row_number() over(partition by col1 order by col4 desc)  rn  from 
    ) where rn=1
    
  • Need help with the condition join in SQL

    Hi all -

    I need to ask for help with this query:

    Create table user_tab_col_test (varchar2 (30) from table_name, column_name varchar2 (30), data_type varchar2 (30));

    Insert into user_tab_col_test (table_name, column_name, data_type) values ('table1', 'column1', 'varchar2')
    Insert into user_tab_col_test (table_name, column_name, data_type) values ('Column2', 'table1', 'varchar2')
    Insert into user_tab_col_test (table_name, column_name, data_type) values ("Column3", 'table1', 'varchar2')
    Insert into user_tab_col_test (table_name, column_name, data_type) values ('column4', 'table1', 'varchar2')
    Insert into user_tab_col_test (table_name, column_name, data_type) values ("column1", "table2", 'varchar2')
    Insert into user_tab_col_test (table_name, column_name, data_type) values ('table2', 'column2', 'varchar2')
    Insert into user_tab_col_test (table_name, column_name, data_type) values ('table2', "Column3", 'varchar2')
    Insert into user_tab_col_test (table_name, column_name, data_type) values ('table2', 'column4', 'varchar2')
    Commit;

    Create table all_cons_columns_test (varchar2 (30) from table_name, column_name varchar2 (30), constraint_name varchar2 (30))

    Insert into all_cons_columns_test (table_name, column_name, constraint_name) values ("table1", "column1", "primary")
    Insert into all_cons_columns_test (table_name, column_name, constraint_name) values ("table1", "column1", "secondary")
    Commit;

    This is my query and the current result:

    Select u.table_name, u.column_name, c.constraint_name
    Of user_tab_col_test u
    Outer join all_cons_columns_test c left
    On (u.table_name = c.table_name
    AND U.COLUMN_NAME = C.COLUMN_NAME
    AND C.CONSTRAINT_NAME IN ('main'))
    order of U.table_name, U.COLUMN_NAME;

    TABLE_NAME COLUMN_NAME, CONSTRAINT_NAME
    ------------------ --------------------- ----------------------------
    Table1 primary Column1
    Table1 Column2
    Table 1 Column3
    Table2 Column1
    Table2 Column2


    Three questions:
    (1) I don't want to return results where table_name = "table1". I can't get this to work.
    (2) is my proper request and this is the best way to return my desired results? For example, I want all of the columns of user_tab_col_test and I want to only display the constraint_name from all_cons_columns_test argument if the argument constraint_name = 'primary '.
    (3) will be the synatx be the same if I need to join a third table to all_cons_columns_test?

    Any advice/suggestions are appreciated-
    John

    Published by: user703358 on January 11, 2013 20:57

    Published by: user703358 on January 11, 2013 21:48

    Hi, John,.

    user703358 wrote:
    Hi all -

    I need to ask for help with this query:

    Create table user_tab_col_test (varchar2 (30) from table_name, column_name varchar2 (30), data_type varchar2 (30));

    Insert into user_tab_col_test (table_name, column_name, data_type) values ('table1', 'column1', 'varchar2')
    Insert into user_tab_col_test (table_name, column_name, data_type) values ('Column2', 'table1', 'varchar2')...

    Thanks for posting the CREATE TABLE and INSERT.
    It is more useful if you post the code that can be run without modification. You did not semicolons after INSERTION instructions.

    Three questions:
    (1) I don't want to return results where table_name = "table1". I can't get this to work.

    What have you tried? Post your best attempt.
    Here's one way:

    SELECT    u.table_name
    ,        u.column_name
    ,        c.constraint_name
    FROM             user_tab_col_test      u
    LEFT OUTER JOIN  all_cons_columns_test  c
                            ON    u.table_name     = c.table_name
                   AND   u.column_name     = c.column_name
                   AND   c.constraint_name IN ('primary')
    WHERE       u.table_name     = 'table1'          --  *****  NEW  *****
    ORDER BY  u.table_name
    ,            u.column_name
    ;
    

    You would not put this condition in the clause; who controls what is considered as a match between the tables, and "u LEFT OUTER JOIN c" means show all lines of u, even if they do not have a match in the c.

    (2) is my proper request and this is the best way to return my desired results? For example, I want all of the columns of user_tab_col_test and I want to only display the constraint_name from all_cons_columns_test argument if the argument constraint_name = 'primary '.

    Basically, this application is very well.
    It displays all the columns of user_tab_col_test; missing data_type. Just add u.data_type to the SELECT clause, or change the SELECT clause

    SELECT    u.*
    ,         c.constraint_name
    

    (3) will be the synatx be the same if I need to join a third table to all_cons_columns_test?

    Do you mean "" * add * one-third * column * to all_cons_columns_test '? "
    It depends on what results you want. Post new CREATE TABLE and INSERT and instructions the results you want new data.
    Most likely, the basic structure of what you've written will remain exactly the same.

  • need help with the Update statement

    Hello
    I received a question in a course and I tried my best to respond, and now my brain is giving. I would really appreciate help with the update statement. I don't mind if you do not validate a solution, a little nudge in the right direction would be really useful. I'll post that I got.

    THE QUESTION
    / * For these agents disabled on more than seven missions, change their date of deactivation of the first date of deactivation of all the agents that have been activated in the same year as the agent that you update currently.
    */

    I have it divided into parts, here is my select statement to agents disabled on more than 7 missions, which produces the deactivation_dates in the agents table that I want to update...
    SELECT
    s.deactivation_date
    FROM
    (
    SELECT
    a.deactivation_date,
    count(m.mission_id) as nomissions
    FROM
    agents a
    INNER JOIN
    missions_agents m
    on
    a.agent_id=m.agent_id
    GROUP BY
    a.deactivation_date
    ) s
    WHERE
    s.nomissions>7 AND s.deactivation_date IS NOT NULL
    .. .and the code for the first date of deactivation for each year of activation agent
    select 
    a2.deactivation_date
    from
    agents a2
    where a2.deactivation_date= 
    (
    select min(a.deactivation_date)
    from 
    agents a
    where to_number(to_char(a.activation_date,'YYYY'))=to_number(to_char(a2.activation_date,'YYYY'))
    )
    ..... I am not real to marry these two statements together in the Update statement. I can't extract each date of deactivation produced in the first select statement and their match against the first date of deactivation in the year they have been activated for the second select statement.

    Any help greatly appreciated... :))

    I began to wonder how things would :)

    user8695469 wrote:
    First of all why he chooses the date the earliest of all agents

    UPDATE  AGENTS_COPY AC /* (1) */
    SET     DEACTIVATION_DATE = (
    SELECT  MIN(AGS.DEACTIVATION_DATE)
    FROM    AGENTS_COPY  AGS
    ,       AGENTS_COPY AC /* (2) */
    WHERE   TRUNC(AGS.ACTIVATION_DATE,'YEAR') = TRUNC(AC.ACTIVATION_DATE,'YEAR') /* (3) */
    )
    

    He recovers as soon as the subquery has not been correctly set in the SET clause. It seems you are trying to update a correlated, but we are still having a conceptual shift. I have added a few comments to your code above and below will explain.

    (1): when you do a correlated update it is useful to the table alias that you did right here.

    (2): this table statement is not necessary and is the reason why the FIRST deactivation date is selected. The alias that you use (3) refers to THIS table, not the one defined in the update statement. Remove the line indicated by (2) in the FROM clause and a correlated update will happen.

    and secondly why is it to update each row, when I thought that I'm just the lines where the agents are disabled and missions > 7? Pointers on where I'm wrong would be very appreciated. (SQL = stupid query language!) :)

    user8695469 wrote: then why is it to update each row, when I thought that I'm just the lines where the agents are disabled and missions > 7? Pointers on where I'm wrong would be very appreciated. (SQL = stupid query language!) :)

    
    WHERE EXISTS
    (
    SELECT
    a.agent_id,
    count(m.mission_id)
    FROM
    agents a
    /* INNER JOIN AC ON AC.AGENT_ID = A.AGENT_ID */
    INNER JOIN
    missions_agents m
    ON
    a.agent_id=m.agent_id
    GROUP BY
    a.agent_id,
    a.deactivation_date
    HAVING
    count(m.mission_id)>7 AND a.deactivation_date IS NOT NULL
    )
    

    Once again this problem is similar to the question above that a correlation update doesn't work. Test existence of lines in an EXISTS subquery. Since your subquery is not related to the table that you are trying to update, it will be always return a line and, therefore, it returns true for EACH LINE in the AGENTS table. To limit the game to only agents > 7 missions results, you need to add a join condition that references the table in your update statement. I added one above (with comments) as a sample.

    I recommend you look over all material that you have associated with correlated subqueries, including documents that I posted above. This seems to be what you're having the problem more with. If you need me to explain the concept of correlated queries any better please let me know.

    Thank you!

  • Need help with the port forwarding for a XBox remote Streaming

    I have a router R6200v2 and need help with port forwarding.

    I came across this set of instructions for setting up stream port forwarding XBox remotely from anywhere

    http://kinkeadtech.com/2015/07/how-to-stream-Xbox-one-to-Windows-10-from-anywhere-with-Internet/

    I have no idea when it comes to such things and I want to make sure I do it correctly without messing up my existing home network.

    Port Forwarding and triggering Port pages setup look very different from what the guy uses. Can someone walk me through what I do to set up please?

    Hi @varxtis,

    You must enter them in the field for a start external Port and external completion Port. You will need to send individually except for the range of 49000-65000. The steps are as follows.

    1. create a Service name (it could be something else that you cannot use the same service name twice. Ex. XBOX1, XBOX2 and so forth.)

    2. Select the type of service (TCP, UDP or both)

    3 entry 5050 times a start external Port and external endpoints.

    4. Select the IP address of your XBOX.

    5. Select apply.

    6 do the same for other port numbers. To the beach, use 49000 for the external departure Port and for the external completion Port 65000.

    Kind regards

    Dexter

    The community team

Maybe you are looking for

  • I can not install an update (KB951847) XP

    I want it please tell me how the get-thank you Separated from the: http://answers.Microsoft.com/en-us/Windows/Forum/windows_xp-windows_update/i-cant-install-an-XP-update-KB951847/6529b9c6-15EE-4b2d-8091-c575a4f34910

  • Signed App will not load simulator

    I follow along with the steps to compile my application using the command line airpackager (provided in * excellent * detail in this thread ... http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/Useful-Tip-Package-Images-Via-Com ) and

  • Dell 3130cn reset reference

    Hello, I try to find a way to reset our Dell 3130cn to factory default.  Raison d'etre, one of our directors have been through the Dell Printer Configuration Web Tool and set the admin password.  Now, he does not remember what it is.  I went through

  • Updated for first 2015.3 CC and now Audio dropped from stuttering frame-type questions...

    I've just updated for first CC 2015.3 on my system running on Windows 7, 32 GB of RAM, quad-xeons double...Seemed like a good idea...  Now, the sound stutters and drop frames.I have a multi-boot system, so I just loaded Adobe CC on my boot Windows 10

  • My trial version is in Russian, how to change English?

    My trial version is in Russian, how to change English?When I install it, there is no doubt about the language.