How to select the lines whose value min on a specific column

I have a query:

Select

m.X1,

round (to_date (l.y1, ' dd/mm/yyyy hh: mi: SS AM')-m.x 2, 0) as numofdays

Of

Table 1 m,

Table2 l

where

l.x3 = m.x3 and

TO_DATE (l.y1, ' mm/dd/yyyy hh: mi: SS AM' ') > = TO_DATE('01012013','MMDDYYYY') and

  ... ;

and I got this result table:

x 1 (ID) NumOfDays
0015

001

1000220033003140 °000566......

several IDs have several values on the second column, I want to have only separate IDs with smaller "numofdays' like this:

x 1 (ID) NumOfDays
0015
0022
0031
0040
00566
......

Any ideas?

Hello

The more general and more versatile way is a Request of Top - N:

WITH got_r_num AS

(

Select

m.X1,

round (to_date (l.y1, ' dd/mm/yyyy hh: mi: SS AM')-m.x 2, 0) as numofdays

ROW_NUMBER () OVER (PARTITION BY m.x1

ORDER BY to_date (l.y1, ' mm/dd/yyyy hh: mi: SS AM' ')-m.x 2

) AS r_num

Of

Table 1 m,

Table2 l

where

l.x3 = m.x3 and

TO_DATE (l.y1, ' mm/dd/yyyy hh: mi: SS AM' ') > = TO_DATE('01012013','MMDDYYYY') and

...

)

SELECT x 1, numofdays

OF got_r_num

WHERE r_num = 1

;

If you would care to post CREATE TABLE and INSERT statements for your sample data, then I could test it.

Note that the subquery (got_r_num) is exactly what you have posted, only with a new column (r_num) added to the SELECT clause.

Tags: Database

Similar Questions

  • How to select the lines/odd table...

    How to select lines / odd in a table?
    Help, please.

    Published by: vaibhav on May 7, 2012 05:30

    This can be done by using the function mod like this:

    For even rows
    Select * from (select rownum rn, nom_table.* from tableName) where mod (rn, 2) = 0;

    For the odd lines
    Select * from (select rownum rn, nom_table.* from tableName) where mod (rn, 2) = 1;

  • How to select the members of level 0 for a specific parent under a Dimension

    Hi friends

    I'm working on a report, I have to select all members of level 0 for a specific parent under a dimension. I can't go to the descendants because I need only level 0.

    Please suggest

    Thank you

    Use @DESCENDANTS and level 0.

    After the selection
    In the Select Members dialog box, click inside the selected area, and then click Advanced
    Use AND to combine the two.

  • Envy5530: How to select the size of output mini iPad picture to urge 5530

    I don, t seem to be able to define the size of the output of my photos when I print from my iPad mini to my desire to hp 5530
    Any help gratefully received

    Hello

    This is not possible, while usng Apple AirPrint.

    You can use the HP ePrint Ap Mobile that allow more control over the print job:

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

    Kind regards

    Shlomi

  • How to classify the lines on a report based on a column value

    Hi gurus,

    I have a dimension of project, each Member of the project are a member of the ProjectStatus into account dim Smartlist Type with these values: new, ongoing, completed... and other account information such as... ProjectName, ProjectStartDate, ProjectFinishedDate...

    I want to create a report like this:

    Page: List of entity
    Column: Project Info accounts
    Rank: List of projects classified by ProjectStatus account as below:

    1. NEW PROJECT
    List of projects with ProjectStatus New
    2. THE CURRENT PROJECT
    List of projects with current ProjectStatus
    3 END OF THE PROJECT
    List of projects with completed ProjectStatus
    ....

    ProjectStatus of each project being different in any of the entities (for example: Entity01->-> ProjectStatus Project01 = New and Entity02-> Project01-> ProjectStatus = finished), it cannot be done by Decree the members of the project manually.

    Is it possible to do it automatically? In the view of the customer, it's a very simple thing with database relationship so we cannot convince those that cannot be done.

    Thank you very much
    Van Huy

    Published by: Van Huy on March 13, 2013 01:17

    You can make a step forward to deleting or sorting based on the value of your smartlist.

    You can sort based on the values, or you can perform a conditional repress.

    Create 3 identical to ProjectStatus as the first member ranks. Perform an advanced delete using the data in cell 1 A = 2 value or the value data in the cell, 1 = 3 (this will give you all the projects with the new State)

    http://docs.Oracle.com/CD/E17236_01/EPM.1112/fr_user_epm/ch02s04s02.html

    Published by: Madeleine Kattookaran, March 18, 2013 06:58

  • How to choose the line PFI to use on the port of the 5761?

    I understand that the VIDEO that I use on my DAC 5761 allows me to access 8 PFI lines.  However, when I access my 5761 devices in the project window by clicking the "+" next to the name of the module, I see that 'PFI Input' and ' output PFI.  I tried to get this to send a signal in the past, but I have been unable to determine how to select the line PFI I want to use.   How can I select the PFI line?

    Any ideas?  I was able to get the my AWG PFI (5422) for work and it is amazing.  I want to order an attenuator digital step for a ground penetration radar that I develop.

    Your time and your help is very appreciated.

    PS: I have worked with this PXI system (chassis, embedded controller, FPGA digitizer 5761 and AWG) for 1 year and I am afraid that it is time to learn this one way or another.

    Good day!

    -Daniel

    I found the solution. In addistion to the node which is visible in my previous post, there must be a node to enable PFI write with an entry of decimal number indicating the line is activated. Then, there must be a node PFI active connector, set to true. Not sure if the node of the latter is really necessary, however. Otherwise above examples should work as is.

  • How to select the second row in three?

    I use answers and are in a situation where some IDs have three related lines.

    I'm trying to flatten it so that each of these lines is displayed as a column.

    So instead of:

    ID fruits

    1 Apple

    2 Orange

    Peach 2

    2 plum

    Mango 3

    I want to see

    1 Apple

    2 plum fishing orange

    Mango 3

    I can get to the first (orange) and the last (plum) with MIN and MAX.

    For example (fruit) MIN or MAX (fruit)

    Answers how select the line in the middle (fishing)?

    Thank you!

    Use LISTAGG, but then to analyze the first second and third in their own columns using regular expressions... or change the data structure to match the use of the information (use is the master, not the slave)

  • How to change the number of values in the hour that are restricted.

    Hello

    May I know how to change the number of values in the hour that are restricted.

    In fact, we have improved of obiee in obiee 11g 10g. Data base is the same for Both.In 10 g the prompt value is limited to show only 35 records per page. As we passed it shows only 35 Records in 11g also. How can I change this limit to 11g.

    Please suggest me! Its urgent!

    Thanks and greetings

    Navnitha

    Hello

    In the advance tab we have the XML of the upgraded report, copy it into a Notepad and try to find the line beginning as below

    In 10g, we have something like below, simply remove the choicesPerPage = '35' from 11 g OBIEE XML report

    Thank you

    RAM

  • How to draw the line under STROKE and fill of an object in illustrator cc? Ideas: D...

    How to draw the line under STROKE and fill of an object in illustrator cc? Any ideas ...

    Aleksandar,

    If I (put) understand it, you will need to divide the object. You can:

    (1) select the object and Ctrl / Cmd + C + F, and then remove the filling of the copy and the blow of the original;

    Draw 2) and drag the new piece down between Division 1 objects) in the layers palette, or select 1 copy) and Ctrl / Cmd + C + F + X + F or similar.

  • Select the line with the smallest Beach

    Hello
    I am trying to build a complex query...
    He must select the line with the inner range...

    I'll explain for example:
    Location of poolsize ID value
    1 32 8
    2 40 6
    3 42 8
    4-36-3

    I want to select the line where the fork between value and value + poolsize is shared also with the other location...
    so:
    1 is 32-40 (in A place)
    2 is 40-46 (in place)
    3 is 42-48 (location B)
    4 is 36-39 (at location B)

    4 is located at 1 (and there are different places...) so sql must return to the fourth line.

    Any help will be appreciated!

    Thank you
    fcbman

    Hello

    fcbman1899 wrote:
    Hello
    I am trying to build a complex query...
    He must select the line with the inner range...

    I'll explain for example:
    Location of poolsize ID value
    1 32 8
    2 40 6
    3 42 8
    4-36-3

    Whenever you have a problem, please post CREATE TABLE and INSERT statements for your sample data, in order to let the people who want to help you re-Ridge the problem and test their ideas.
    See the FAQ forum {message identifier: = 9360002}

    I want to select the line where the fork between value and value + poolsize is shared also with the other location...
    so:
    1 is 32-40 (in A place)
    2 is 40-46 (in place)
    3 is 42-48 (location B)
    4 is 36-39 (at location B)

    4 is located at 1 (and there are different places...) so sql must return to the fourth line.

    To find all the rows that are within the range of at least one other line with another location:

    SELECT     *
    FROM     table_x  m
    WHERE     EXISTS (
                 SELECT  1
                 FROM        table_x
                 WHERE   location          != m.location
                 AND        value          <= m.value
                 AND        value + poolsize     >= m.value + m.poolsize
                )
    ;
    

    When you talk of the "" * most * inner range ", do you mean that you might have another line, such as"

    INSERT INTO table_x (id, vlue, poolsize, location) VALUES (5, 37, 1, 'C');
    

    which is inside the range of id - 4, and that's why you wouldn't have id = 4? If so, include examples in the results and data sample yout. You can do this with a query CONNECT BY, or, depending on your version of Oracle, a WITH recursive clause.

  • How to pass the parameters or values film double hollow?

    Hello

    I create a game in Flash 8 with 2 AS and I have some questions to ask.

    First of all, I'm stuck for 2 days to create a tower Laser beam to the target.

    I searched the internet for solutions but I can't really find one, so I'll try display of questions myself...

    First I tried to create, and the effectHolder in which each laser beam has been created, because it seems I can create only one line in each movieClip...

    _root.duplicateMovie(effectHolder_mc , "effectHolder_" + this, _root.getNextHighestDepth());
    v = a = _root["effectHolder_" + this];
    ray.onEnterFrame = function()
    {
    v.clear();
    v.lineStyle(1,0xFF0000,100);
    v.moveTo(this._x, this._y);
    v.lineTo(creep._x , creep._y);
    v.text = "True"

    }

    It's triggered eveytime, she was a target.

    With each turn that triggered a laser that I created, it became more than offset, so I tried selfdestructing after some time.

    this._alpha -= 10;

    if (this._alpha <= 0)

    {

         this.removeMovieClip();

    }

    But he did not actually work, so I tried another solution. I tried to give each MovieClip ("Laser"), duplicate code that creates the laser beam.

    onClipEvent(load)
    {
         this.fx = from._x;
         this.fy = from._y;
         this.tx = to._x;
         this.ty = to._y;
    }
    onClipEvent(enterframe)
    {
         _root.dmg.text = "From: " + fx + "," + fy + " To: " + tx + "," + ty; //I used this on a textbox to see if parameters are transmited. But they were all 'undefined'

            this.clear();
         this.lineStyle(1,0xFF0000,100);
         this.moveTo(from._x, from._y);
         this.lineTo(to._x , to._y);

         this._alpha -= 4;
         if (this._alpha <= 0)
         {
              this.removeMovieClip();
         }
                                 
    }

    The problem is that I did not know how to pass the coordinates of the tower and the target to the MovieClip so that it knows where to create the line.

    X++;
    duplicateMovieClip(_root.Laser, "Laser" + X, X,{from._x,from._y,to._x,to._y});         
    g = _root[_root.Laser + X];
    g.fx = from._x;
    g.fy = from._y;
    g.tx = to._x;
    g.ty = to._y;

    Please leave suggestions on how to send the parameters or values for the created clip, or an idea of the creation of this line ("beam") for each tower, without so much trolling.

    Thank you

    Chris

    What is the trigger of v's _alpha decrease?

  • Printer all in one HP3520 - how to select the wireless network and enter the WEP key?

    According to print my wireless network is detected.

    How to connect the! @# % printer $ fo the wireless network and enter the WEP key?

    Instructions on the HP site tell me to selet NETWORK on the printer control panel.  Well, there's a way to select the NETWORK from the control panel.  It is not an option for him.

    I downnloaded and installed the latest drivers.

    I have restored the default settings.

    How to select the wireless network and enter the WEP key?

    All of HP's instructions seem to be for a newer printer with a touchscreen.

    I want that the printer is connected to my main computer via the USB port.  I want to be able to print wireless phones and tablets.

    My 3520 is not a 'touch Screen' and it has wifi.

    However, the following work:

    Try to open the HP Deskjet 3520 icon, open the utilities tab, click on convert USB wireless, by following the steps on the screen.

    This leads me to believe that ONLY the wireless doesn't work.  I know now that the part of the sentence "Convert USB to wireless connection" is supposed to mean "works like USB and wireless.

    Thank you for your help

  • How to recover the bios password hp mini 110-1144NR cnu938553m

    Help, please

    Need help how to recover the bios password hp mini 110-1144NR

    Series # cnu938553m

    Hello

    What is the code stopped? Please try (all in small character):

    e9lofuqqf4 (3rd tank is a tiny character of the letter L).

    Kind regards.

  • How to select the pieces of my image in black and white?

    How to select the pieces of my image in black and white? FOW example letter J or the circle or the two together?

    jaguar_growler_blur best8.png

    It's actually pretty easy, but I have to assume that you know a few basics in Photoshop

    (1) open your existing image

    (2) double click on the layer and the 'layer style' appears. In the mix if area set the sliders so the whites in the image disappears

    You will be left with just the black elements in design

    (3) duplicate layers

    and merge them together

    to give a standard layer

    (4) ctrl or cmd click on the layer to select and create a layer mask

    (5) you now have a mask of the image. Duplicate the layer, click alt or option, click on the layer mask to call

    (6) the blacks and the whites are not completely black and white for the use of levels to adapt to the absolutes

    (7) now you have to decide what you want to select. In this case, I chose the lettering and simply covered everything else to the top with black. You do this by lasso selection and fill and items when it's delicate brush just the details with a black brush "hard." .

    (8) at this stage, you can do what you want you have a layer mask. So you can color the text for example

    or place in a background color and apply a layer as Beveling effect

    Hope that makes some sense. It is much easier to do than to describe.

  • How to select the Type of industry 8.3 Professional P6

    Hi all

    According to the document to change the type of industry for 8.3 Professional P6, I had to go to P6, Application settings, general link.

    But in the P6 Web client to administrator > Application Configuration > General there is no option is available for the type of industry.

    Let me know, how to select the type of industry?

    You can see the OPINION score "How to change the Type of industry P6 P6 PPM (Professional), P6 EPPM E8.2 and later versions (Doc ID 1386047.1)".

    Also can you paste a screenshot here.

Maybe you are looking for