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.

Tags: Database

Similar Questions

  • Selection of lines with the range Paging VO

    Hello

    JDev 11.1.2.4

    I created a VO based on an OA. I added a transitional attribute in the original Version, this attribute is named Selelected of type Boolean initialized to false (default value Expression: false-Expression of Refresh value: false). That VO appears as an af:table. The attribute is displayed as selectBooleanCheckbox. The VO is set with an access mode of range Paging and a size of 28.

    < af:selectBooleanCheckbox value = "#{row.bindings.Selected.inputValue} '"

    label = "#{bindings." VwRhdPortfolioTranWrkSend11.hints.Selected.label}.

    required = "#{bindings." VwRhdPortfolioTranWrkSend11.hints.Selected.mandatory}.

    shortDesc = "#{bindings." VwRhdPortfolioTranWrkSend11.hints.Selected.tooltip}"id ="it1' autoSubmit = 'true '.

    valueChangeListener = "#{pageFlowScope.portfolioTransferBean.onWorkSelection}" >

    < f: validator binding="#{row.bindings.Selected.validator}"/ >

    < / af:selectBooleanCheckbox >

    The table shows the 25 lines. The user clicks one of the checkbox to select a line. The valueChangeListener is called with the new value (auto submit = true) as expected. Then the user scroll down for another "page" in the table, new lines are displayed. Then it scrolls to the first page. The previous selected checkbox is reset as not selected. The selection is lost.

    Is this expected behavior? If so how do you get a selection of lines with a VO of range paging.

    Thank you

    Try to create the transitional attribute in OT instead of VO.

    See you soon

    AJ

  • Table (ADF 11 g) does not get updated on the selection of lines...

    Hi all

    I have a table element (ADF 11 g) in my page with the selection of multiple lines. I have my own row selection listener. Whenever I have select several lines with the CTRL key, the table is getting updated. It is fetching the data again for each selection. I don't want the table to get updated whenever I select a line. In the im listener manually selected do the line current. The code below is the table row selection listener.

    public void tableRowSelectionListener (SelectionEvent selectionEvent)
    {
    Add the code in the event here...
    String tableRowSelectionListener = "tableRowSelectionListener";
    Table richeTableau = (RichTable) selectionEvent.getComponent ();
    Set of keys to RowKeySet = table.getSelectedRowKeys ();
    Txn_id = number ((Number) ((Key) ((List) keySet.toArray () [0]) .get (0)) .getAttribute (0));
    int noRowsSelected = ((List) keySet.toArray () [0]) .toArray () .length;
    Rank [txnrows] = null;
    if(noRowsSelected == 1)
    {
    PscTransactionsViewImpl txnVO = (PscTransactionsViewImpl) amImpl.getPscTransactionsView2 ();
    if(txnVO!=null)
    txnrows = txnVO.findByKey (new Key (new Object [] {txn_id}),-1);
    If (txnrows! = null & & txnrows.length > 0)
    {
    SelectedRow PscTransactionsViewRowImpl = (PscTransactionsViewRowImpl) txnrows [0];
    txnVO.setCurrentRow (selectedRow);
    }
    }
    }

    How to select a row in the table easily (without the table is refreshed). ?

    Thanks in advance,
    Swathi

    Hi swati,

    Set property of 'changeeventpolicy' on 'none' & 'useRowHints' to 'default' for the list that you iterate.

    YP.

  • Just updated to Sierra and updated Pages at the same time. Now when I try to select a line of text I find myself with an insertion point where I stopped by selecting

    Today, I updated for Sierra and updated to the latest version of the Pages. Now I find that I am more able to select a line of text. When I try to do, I find myself with an insertion point where I stopped by selecting, but nothing is selected. This is a bug in the new version of pages or get my wrong settings?

    You use a Wacom tablet by chance?

    Solution: Press the shift key, just before stop selection. And Yes, that sounds like trouble in the Sierra.

  • Select the lines with the maximum value for a date where another column is different from 0

    Hello

    I need to write a query on a table (called DEPRECIATION) that returns only the rows whose date maximum (PERENDDAT_0 column) for a specific record (identified by AASREF_0), and where the other column in the table called DPRBAS_0 is different from 0.

    If DPRBAS_0 is equal to 0 in all the lines of a specific record, then return the line with date maximum (PERENDDAT_0 column).

    To be clearer, I give the following example:

    Suppose we have the following data in the table of DEPRECIATION:

    AASREF_0 PERENDDAT_0 DPRBAS_0
    I2011001074331/12/20150
    I2011001074331/12/20140
    I2011001074331/12/20130
    I2011001085612/31/20160
    I2011001085631/12/20150
    I2011001085631/12/2014332
    I2014001223812/31/2016445
    I2014001223831/12/2015445
    I2014001223831/12/20140

    The query must return only the following lines:

    AASREF_0 PERENDDAT_0 DPRBAS_0
    I2011001074331/12/20150
    I2011001085631/12/2014332
    I2014001223812/31/2016445

    Thanks a lot for your help!

    This message was edited by: egk

    Hello Egk,

    The following query works for you.

    SELECT AASREF_0, PERENDDAT_0, DPRBAS_0

    FROM (SELECT AASREF_0,

    PERENDDAT_0,

    DPRBAS_0,

    ROW_NUMBER)

    DURING)

    AASREF_0 PARTITION

    ORDER BY

    CASE WHEN DPRBAS_0 <> 0 THEN 1 OTHER 0 END DESC,.

    PERENDDAT_0 DESC)

    RN

    DEPRECIATIONS)

    WHERE rn = 1

  • Select the query with the level line list where the clause

    Hi all

    I am creating a tabular presentation based on a SQL query that has a list of selection based on a query with a where clause clause that refers to a column in the original SQL query.

    The situation is, I have a table that stores the client_id, source_id, and build_id, lets call it client_source. I have a second table, build_source, containing source_id and build_id, one to many relations between the two (1 source_id could have build_id 1-7).

    Using a tabular presentation, I want to select the correspondent build_id to use in client_source, but the selection list should contain only the build_id for this particular source_id of lines.

    Here is an example of the SQL source of tabular presentation;

    Select
    s.ROWID,
    s.CLIENT_ID,
    s.SOURCE_ID,
    APEX_ITEM. SELECT_LIST_FROM_QUERY (1, s.BUILD_ID,)
    "Select display b.build_id, b.build_id return.
    b build_source where b.source_id = s.SOURCE_ID ') lst
    of s client_source

    what I want to achieve, it's as source_id "BOLD" match fields. When the query is built this way, I get an error of "invalid identifier" Oracle on s.SOURCE_ID during execution.

    Is there some special tags to be used to refer to the external column? I must be missing something because this looks like a pretty mundane problem.

    I am running on 4.1.0.00.32, on an Oracle 10 g release 10.2.0.4.0 Server Express request.


    I look forward to useful responses!


    See you soon,.
    Jason

    Published by: 1005131 on May 9, 2013 19:02

    Your selection by query list receives a static SQL. That SQL can't "see" the value of your s.source_id.
    But it would work like this:
    where b.source_id = ' | s.SOURCE_ID)

    You would be the value for the SQL concatenation. It is not ideal, but it will work.

    Jorge

  • How to make a straight line with the Quick Selection tool?

    Hi, I'm experimenting with Photoshop CS6 and wanted to autofocus on poles and the alley only, everything is blurry (the sky, cars, trees and higher levels). The image shows a better idea of what I mean. I am currently using the Selection tool quick to fill between the poles, then using fuzzy area, but is at - it a faster and more efficient way to do this? In addition, the quick selection tool is not perfect and shows jagged - like of the spots along the edges of the poles. I thought maybe it's posible to right field line as a box between poles and blurred in this way?WP_20130806_12_45_41_Pro[1].jpg

    You would like to use the Polygonal Lasso tool to create your form of selection. Once you use blur filters, this will create a cutting edge on the mask. Select the mask in the layers panel and then apply a Gaussian blur to the mask to smooth the edge. (or use refine edge)

  • select lines with garbage (not the numbers and point symbols)

    Hi all! I've got varchar2 column where users insert what they want. But this column is used for the value of numbers (from 0.00 to 100.00). How can I select only the number and the symbol dot:

    NVL (ABS (regexp_replace (Replace(Avalue,',','.'),'[^ 1, 2, 3, 4, 5, 6, 7, 8, 9, 0,.,]')), 0)

    Now, I need to select lines with symbols of the trash to correct errors. How do I "invert selection"? I mean by selecting only the lines that are composed of waste (except the numbers and the dot symbol).
    Thanks in advance.

    You can try this

    select trim(translate(replace(avalue,',','.'),'1234567890.','           ')) from dual
    

    If the symbols of the trash will be inserted then it will return that

  • How to organize a table like 'move with the text' and 'around and underneath "? For now, my only option in the menu drop-down is "in line with text.

    Hello. I am trying to format a table, so that when I hit it, it moves to the bottom of the page and the bumps any text underneath down as well (that is if you can see the whole table and all text at any time)

    .

    However, the only options I seem to have are moving with the text > inline with the text. The first part is what I want, but having the means of inline with the text of table than all text below it floats UNDER the table, and you can't read it.

    PIC 1 - My only option when "move with the text" is selected. As you can see all the other features are also grayed out.

    Photo 2 - I want now, select above and below, but when I select something other that in line with the text...

    PIC 3... it jumps to stay on the Page option is not what I want.

    Any ideas?

    You can have a floating table in v4.3 Pages ' 09 that moves before the text typed before it, but this feature has not been added to any release of v5 Pages. Simply set the table in the Wrap Pages ' 09 Inline with the text Inspector, and object causes the film if you wish.

  • Select the line of contour based on static text

    Hello

    Thank you much in advance.

    As I'm fairly new to AppleScript, I don't know what is and what is not possible. My goal is to have a single script that works for 7 of our branches and about 1,500 people. The idea for the script is:

    1. ask the user some basic questions (like "which office are you?" and "What is your code print?" - already scripted.)

    2 something here to select the appropriate section of the code required for these specific functions. In other words, if user pics office 1 go to any section of the code that corresponds to the office 1 if 2 go 2, etc. - not scripted, I'm used to something like goto, but if I understand well there is no such thing with ACE

    3. based on the information in the point 1, if possible, download a file from the internet (a package) and install it. I guess I should wait or pop to draw their attention to the fact that they would need their password and wait they ended as a dialog box. I know that the password is not scriptable. - not scripted

    4. a procedure (for each location but very similar) script:

    4.1 find if printers have been installed (based on the content of the Printers & Scanners window and printer names). - ongoing

    4.1.1. If so, select and remove.

    4.1.2 if not, continue

    4.2 install printers for this office. - scripted.

    4.3. implement their code printing with a couple of presets - scripted

    Where I am stuck currently is:

    1 choice of the line of the scroll printers area contour & Scanners based on the name of the printer. I try this, but it does not work (for some reason any CRUDE HTML does not work):

    Tell application "System events" tell process select 'System Preferences' (first line of end of plan 1 zone 1 scroll the window 1, including the value of static text 2 is "SAvin_372BC" tell end tell

    Accessibility Inspector is telling me this:

    AXApplication > AXWindow:AXStandardWindow > AXScrollArea > AXOutline > AXRow:AXOutlineRo w > AXCell > AXStaticText for the text where the Savin_372BC is displayed. I found this and tried to do something similar to script, but obviously I did not. As I do not know how many printers user will have I need for AS through, find those that we install and remove them if they are present and move along, otherwise - move along.

    2. how script logic? As I mentioned previously, I'm used to goto, so it would be to ignore whatever the section, I need to continue from. What would be the AS version for goto?

    3. using the script and without install anything that anyone else who isn't Apple, how do I download a pkg in / downloads? CURL?

    4. I'm not there yet, but no matter what magic trick as waiting for an entry for the Mac password?

    Thanks a lot again!

    I'm used to something like goto, but if I understand well there is no such thing with ACE

    The man.  GoTo went in disgrace for 40 years!  No modern language has goto. GoTo lead unrestricted branching which resulted in convoluted code.  A fluidity in the code is desirable.

    From this page:

    http://computers.tutsplus.com/tutorials/if-and-if-else-AppleScript-conditional-s statements - mac-45590

    ------------------------------------- AppleScript

    Learn AppleScript: The comprehensive Guide to Scripting and automation on Mac OS X, the book of the third edition

    AppleScript Language Guide pdf Download pdf file

    Intro to applescript with the sending of an email
    http://Mac.AppStorm.NET/how-to/AppleScript/the-ultimate-beginners-guide-to-Apple script.

  • Is it possible to delete a plot with the help of the mouse select the chart control?

    For example, when I use the plot to draw thousands of lines on the chart control, I want to delete some of them, but there are thousands of generated plotHandle.

    How can I get the plotHandle of the specific line on the chart control with the help of the mouse to select the option?

    If I save the information from the lines, such as the plotHandle and the coordinates on a table or list, etc, I compare information lines for the plotHandle of the specific line.
    Is it all a user-friendly way to remove a track selection on the chart control?

    I can't give you a reasonable way to solve this problem, since as you have already noted plot do not snappable plots.

    A possible warkaround would be to replace the plot of individual instructions with a PlotXY matching with 2 bays 2 points each, which correspond to the x 1, x 2, y1, y2 parameters to plot. PlotXY plots are snappable, so you can enable this procedure select the plot and remove it.

  • I did a system restore and boot has changed. The only program that I can open is all the others, that I wonder select the program to use to open with Explorer. What should I do?

    It is no longer a row of icons at the bottom right, and asked me to choose a program to use to open files

    Hello and welcome to Microsoft Answers. It seems that your computer is infected with malware. The first thing you need to do is re - associate your executable files with applications.

    First

    Click Start > run > type cmd in the Run dialog box, and then press ok. On the line of command prompt type "assoc.exe = exefile" without the quotes. If you are unable to open the applications follow the second below.

    Second

    Right click on start > search. Type rundll32.exe in the field of the files to be searched. Choose to search for your main drive (usually C). Select the search hidden files and folder advanced features. Click on the search button to start the search. In the results list, find the associated rundll32 file C:\WINDOWS\ServicePackFiles\i386. Right-click on rundll32 to the left of the directory above and choose 'open file location '. The rundll32.exe file should be highlighted when the folder opens. Right-click on the file and choose copy. Then, in the search results list, right-click on rundll32 which corresponds to C\Windows\system32\rundll32.exe and choose "open file location". Again the file should be highlighted. Right-click on the file and choose Remove. Right click again in a free space in the folder and choose Paste. If this does not resolve your problem, you will need to get a windows OS disk and extract the file from there.

    Once this problem is solved, you will need to perform several anti-malware analysis. You should start with Malwarebytes. Make sure that you update the parser before the scan.

    Malwarebytes.org

    How to use Malwarebytes

  • URGENT magic wand tool selects a line drawing, instead of the space between

    Hello

    I am coloring/rendering a map of the places where I imported a PDF of line drawing prepared in Autocad. To do this, I usually start with the magic wand tool to select areas on the plan and block everything with the pot of paint color. However, this time when I select objects (say the building) selects the black lines in the layer (the line drawings) rather the space between the two. I checked to see if all the lines are closed and I played with the tolerance but he still picks on the lines instead. I tried both on a transparent background and tried to merge the lines with a layer of white background but without success.

    Please help if you can, I have a tight deadline to finish it and use the polygonal selection on everything that would be both pain and take too much time! I have Adobe Photoshop CC 2015.

    Thank you.

    If there is a problem with gaps - create a copy of the layer. Apply a 1 - 2px Gaussian blur. Use the magic wand on this layer, then make your choice.

    Dave

  • How to draw a line (with the line segment tool) then draw another line, from those previous anchor point. When I try immediately draw another line on the other anchor lines it try to turn instead.

    I'm following a course of basic fundamental illustrator on Lynda. The video of "draw straight lines" is troubling me. They draw a line with the line segment and then draw another line coming out the anchor point at an angle.

    Here's where it is troubling me - when I try to drag a line to the anchor point trying to transform the first line, I drew. (the line cursor turns into a selection tool) I can't draw another line connecting the first.

    Advice would be great because it's driving crazy me.

    See you soon,.
    Kyle

    Yes, it is irritating. You must clear the previous line first. If you want to make sure that both ends are perfectly aligned, start by turning on the guides. If you want two lines to be part of the same way, you should use the tool pen instead.

  • How to animate a line with the pen tool to give the impression that it is plotted?

    How to animate a line with the pen tool to give the impression that it is plotted?

    Or you can choose the pen tool (g), set the padding to zero and the race to what you want, then draw a path, then press U twice to reveal all of the properties that have been changed for the layer, and then click Add (top-right) and select Connect the tracks.

    To make the race work just animate the start or end point and sent to paint on original or reveal original or normal.

Maybe you are looking for

  • NEITHER 9871 best way to create the customization to veristand

    I would use a NI 9871 module with NEITHER veristand to connect with over RS-485 devices using the modbus Protocol. I know that this device can be used in mode of scanning and orders VISA, but won't work with the custom device EtherCat Scan Engine. I

  • System disabled flag code 09437 pls help

    My hp dv1000 projection system off code 09437 pls help

  • Prevent editing of legend

    Okay, that's annoying me now. I have a graph of waveform in my current application. I use a lot of control by programming so that it can adapt and displays just the way I like it on the front panel (the application is highly customizable to the user)

  • delete the files yet, create it

    I went to the 'my computer' 'Search' type I see the folder so I type 'remove '. Then she appears, the file "delete and not exist and ask me to 'create'.» When I type "recreate", "feature" it appear but nothing inside. IM using window vista Home premi

  • Connection of BBM app problem

    Hello I try'ing to connect my application with BBM on simulators, it works fine, but the device I get boot error.Connecting to BBM step 2 of 4: check that I receive: server is unavailable. Impossible to proceed with the connection of BBM. Please try