How can I get the second max and max third in the list of values

Hai All


I have four to Six calendar in a table and I need to insert these values in another table to help if another logic...

For example

this if 0815,1130,1230,1715 can get maximum of 2nd and 3rd maximum

I have four columns in another table

Respondent, intrinsically, Introut, Outtime and I need to store the intimate min and max in outtime and 2nd intrinsically min and 2nd max in introut to help if another logic

Thanks and greetings

Srikkanth.M

It might be more like what you want:

SQL> with t as (
  2  select to_date('0815', 'hh24mi') as is_time from dual union all
  3  select to_date('1130', 'hh24mi') as is_time from dual union all
  4  select to_date('1230', 'hh24mi') as is_time from dual union all
  5  select to_date('1715', 'hh24mi') as is_time from dual
  6  )
  7  , tt as (
  8   select is_time
  9         ,min_time
 10         ,max_time
 11         ,max(dn) over (partition by null) as max_dn
 12         ,min(dn) over (partition by null order by is_time) as min_dn
 13         ,dn
 14   from  (
 15    select is_time
 16          ,dense_rank() over (order by is_time) dn
 17          ,min (is_time) keep (dense_rank first order by is_time) over (partition by null) as min
_time
 18          ,max (is_time) keep (dense_rank last  order by is_time) over (partition by null) as max
_time
 19    from t
 20        )
 21  )
 22  select tt.is_time
 23        ,tt.min_time
 24        ,tt.max_time
 25        ,tt.max_dn
 26        ,tt.min_dn
 27        ,tt.dn
 28        ,case
 29          when max_dn - dn = 1 then
 30            tt.is_time
 31         end as second_max
 32        ,case
 33          when max_dn - dn = 2 then
 34            tt.is_time
 35         end as third_max
 36  from tt
 37  /

IS_TIME             MIN_TIME            MAX_TIME                MAX_DN     MIN_DN         DN SECOND_MAX          THIRD_MAX
------------------- ------------------- ------------------- ---------- ---------- ---------- -------
01/03/2010 08:15:00 01/03/2010 08:15:00 01/03/2010 17:15:00          4          1          1
01/03/2010 11:30:00 01/03/2010 08:15:00 01/03/2010 17:15:00          4          1          2                     01/03/2010 11:30:00
01/03/2010 12:30:00 01/03/2010 08:15:00 01/03/2010 17:15:00          4          1          3 01/03/2010 12:30:00
01/03/2010 17:15:00 01/03/2010 08:15:00 01/03/2010 17:15:00          4          1          4

4 rows selected.

Tags: Database

Similar Questions

  • How can I get the list of data stores in a cluster data store?

    How can I get the list of data stores in a cluster data store? I mean the command line option.

    Hello

    by command line, you mean PowerCLI?

    If so, you can display data with this warehouses:

    Get-DatastoreCluster-name DSClustername | Get-Datastore

    Tim

    Edit: Moved the thread to the PowerCLI community

  • How can we get the list of files in a folder?

    Hi all

    My plugin has a list of .ai files in the user interface of the folder C:\Program Files\Adobe\Adobe Illustrator CS4\Plug - ins\Illustrator Filters\MyPlugin.

    Also, if we put 'MyFile.ai' in the folder 'MyPlugin', then the user interface should display the MyFile (file name) in a drop-down list box.

    I want to get the list of files in the folder "MyPLugin".

    Download the plugins to HAVE

    AI::filepath pluginsFolder.

    sAIFolders-> FindFolder (kAIPluginsFolderType,

    fake , pluginsFolder);

    MyPlugin folder

    AI::UnicodeString MyPluginFolder (pluginsFolder.GetFullPath ());

    MyPluginFolder.append (ai::UnicodeString ("\\Illustrator Effects\\Myplugin\\"));

    Here I get the my full path of the folder plugin in "MyPluginFolder".

    Now, this file, I want to get the list of files that I placed?

    What are the APIs available in artificial intelligence to get the list of files in a folder?

    If you want to enumerate files in a directory, you have to use the OS APIs. I does not provide for this. There are different ways to find important files/directories related to AI, but nothing else.

    The APIs to do this in the operating system are usually pretty easy to use but. Annoying if you try to hit Mac and Windows, but a little care in the design of your interface and hide the worst.

  • How can I get the classic report value when I click on the record?

    Hi all

    I have a simple classic report and I want to get the empno when I click on record. For example, when I click on record 1, and I'll go '7369', if I click on the 3 card, and I'll go '7521'. How can I do this? Please help, thanks!

    Hi jane.kuang,

    Jane.Kuang wrote:

    Thank you very much!!! Your message is useful for me. But this javascript has something wrong. When I click on the first time, the empno appears only once, but when I click on the other record, empno appear twice, and I click on the third time, it appears three times... I'm new to JS, I don't know how to fix it. Thank you!

    Use instead the dynamic action to that effect.

    Here are the steps:

    • Change your region classic report-> section 'Attributes'-> 'ID' static-> give an id say myempregion static
    • Create a dynamic action with the following attributes:

    Event: click on

    Selection type: jQuery Selector

    jQuery Selector:

    #myempregion table.uReportStandard tbody tr
    

    Action: Run the JavaScript Code

    Code:

    var empno = $(this.triggeringElement).find('td[headers="EMPNO"]').text();
    alert(empno);
    $('#P21_X').val(empno);
    

    Items concerned: keep it unselected

    • Change once created, your dynamic action-> go to section 'Advanced'-> set 'Extended event', 'dynamic'.

    This will fix the following in the code of the Para:

    • The jQuery Selector used by Para to trigger the click event is bad. This will fix the multiple alerts.
    • Para code won't work on loading the page, but if there are many rows in the table and pagination for the report is in place, and then when you paginate your report, it will not work. But it will work with dynamic action 'Scope of the event' the 'Dynamic' value even when you paginate the report.
    • Finally, most of the dynamic interactions page must be converted to dynamic actions, this will help the maintainability of the code, instead of stacking the javascript in your page.

    Kind regards

    Kiran

  • Upgrade to Adobe Acrobat Reader DC empty my list of recently opened files. How can I get the list?

    Why my file information, I recently opened in Adobe Acrobat Reader disappears without my permission?

    Hi angry_customer,

    Is not possible to retrieve the list of recent files. But this does not mean that the files are deleted, it displays only the files that you recently viewed for quick access. Once you start to open the files again, he'll get which are listed there.

    Kind regards
    Nicos

  • How can I get the list of warehouses of data in a folder?

    I created folders at the level of vCenter and adds data warehouses. How to list of data warehouses in a particular folder?

    PowerCLI-

    Get-File-Name [name of folder] | Get-Datastore

    Please do not forget to mark the answers useful or correct.

  • How can I get the list of Contacts to show?

    There is a 'contacts' list that is separate from the address book (#&! % *!). I look forward to Mozilla. Why can they make this clear?

    Speaking of not being clear. Where you expect to see this list?
    There are contact sidebar in a window of writing. Pressing F9 it switches on and outside.

  • How can I get the list of recorded TV to display in columns?

    Windows Media Center displays TV recorded in columns on one of my PC and in a long horizontal flow on another PC. Both are Windows Vista.

    I finally found my own answer. In landscape view, right-click on the screen and choose "View List".

  • How can I change the list of values for elements of type display in a VAC in ID format to the format of name?

    I have concert and venue of 2 tables. I imported xml file dummy values and data are imported to db with success. When I go to ACC, afer, select my EventsRepository-> show-> click on list. display the results in ID formatEventRepository:Concert:70701.

    Can someone like me how to show my results?

    "You must set the display property ="> " in the element-descriptor tag."

    for example

    See you soon

    R

  • How can I get the second and third highest salary from the emp table

    How can I get the second and third highest salary from the emp table in the ecah Department
    SQL> ed
    Wrote file afiedt.buf
    
      1  select empno, ename, sal, deptno
      2  from (
      3    select empno, ename, sal, deptno, dense_rank() over (partition by deptno order by sal desc) as rn
      4    from emp
      5    )
      6* where rn in (2,3)
    SQL> /
    
         EMPNO ENAME             SAL     DEPTNO
    ---------- ---------- ---------- ----------
          7782 CLARK            2450         10
          7934 MILLER           1300         10
          7566 JONES            2975         20
          7876 ADAMS            1100         20
          7499 ALLEN            1600         30
          7844 TURNER           1500         30
    
    6 rows selected.
    
    SQL>
    
  • How can I get the max of a measurement value

    How can I get the max of a measurement value?

    http://forums.NI.com/T5/LabVIEW/how-can-I-return-the-maximum-value-from-a-voltage-sensor-over/m-p/30...

    I tried the while loop max-min-solution described in this link. But this using my myRio acceleration measurement no longer works. It seems to hang.

    I use the I2C Communication.

    The inner circle while loop is a bad construction.  It will be either executed once, if enter the Boolean value is True, or forever if the value is false.

    Put your records on the timed loop shift and eliminate inside while loop.  Then your code should work.

  • How can I get the six digit code for my iPad Pro? I have two other iPads and an iPod but I enter the codes I get and the Pro is just off!

    How can I get the six digit code for my iPad Pro? I have two other iPads and an iPod but I get the codes I get and the Pro is just disabled for longer and longer whenever he rejects these codes!

    If you have forgotten the password for your iPhone, iPad or iPod touch, or your device is disabled - Apple supports

  • How can I get the tabs to go on a single line and a menu of Firefox?

    Firefox allows to have 2 lines above - Firefox menu with tabs and more and another line of the navigation toolbar. during the installation of some programs online, Firefox now have 3 lines at the top, with the Firefox menu on an entire line, the 2nd line of tabs and 3rd line of navigation toolbar. How can I get the tabs to go on a single line and a menu of Firefox?

    With the current versions of Firefox, you can choose to use the menu of Firefox (orange in windows; gray Linux) button at the left end of the Windows title bar or bar menus familiar as in earlier versions. The Firefox button is displayed by default only in Windows Vista and Windows 7, but you can turn on or off or switch between the two or temporarily show the menu bar when the Firefox button is displayed.

    If you chose to use the Firefox button and you use the default tabs on top, the tab bar will move to the title bar with the Firefox button only when you are to maximize window (the ' square' the middle button in the upper right corner of the Windows standard application window). Other selected toolbars will be displayed below that (bar Navigation, Bookmarks Toolbar and the toolbars you add via Add - ons).

    If this answer solved your problem, please click 'Solved It' next to this response when connected to the forum.

    Not related to your question, but...

    You must update some plug-ins:

  • I have all the games Age Of Empires, the versions of Windows and I changed to a Mac computers. How can I get the Mac version of the games and use my existing serial keys?

    I have all the games Age Of Empires, the versions of Windows and I changed to a Mac computers. How can I get the Mac version of the games and use my existing serial keys?

    Hello

    As you have bought Age of Empires for Windows OS, you will not be able to install the same copy of Age of Empire Windows version on Mac. However, you can contact the telephone support for confirmation on this issue.

    Here is the link:

    http://support.Microsoft.com/kb/295539

  • How can I get the exact time and date on my FAX LOG

    I have a new HP Officejet 6500 has more on my Dell Inspiron Windows XP computer.  How can I get the exact time and date on my FAX log?

    Hi FrederickFrank7,

    Journal of faxes would just follow the time of your printer. Please set the time and date of your printer.

    I am an employee of HP.
    Please indicate the position that solved your problem as "acceptable Solution".

  • How can I get the rest of this virus off the coast? Ive found a bunch and sank them until I can get online

    How can I get the rest of this virus off the coast? Ive found a bunch and them came down until I can get online but I can 't get to work stations or other programs. I have to run in safe mode to do anything properly. This is where I removed the malware and other viruses but I'm not sure it fixed stuff I need in normal mode.

    How can I get the rest of this virus off the coast? Ive found a bunch and them came down until I can get online but I can 't get to work stations or other programs. I have to run in safe mode to do anything properly. This is where I removed the malware and other viruses but I'm not sure it fixed stuff I need in normal mode.

    Just to add to the answer above, once you have completed the scan with Malwarebytes in SafeMode with network, restart the computer in normal mode, look for the Malwarebytes updates, then perform another analysis.

Maybe you are looking for

  • What can I upgrade the processor in an HP Pavilion dv7-1285dx

    can I upgrade the processor in an HP Pavilion dv7-1285dx I have Intel (r) Core (TM) 2 Duo CPU P8600 @ 2.40 GHz

  • Win 7 games and earlier versions

    I just got a new system and makes the error for Vista 64-bit!  Hardly my favorite/flight sims games will work, even with compatibiliy mode.  It goes the same for my printer. SE games/sims made for XP, specifically, IL2 Sturmovik, hero of the Pacific

  • WINDOWS MEDIA PLAYER (windows 7) will not play. Correctly the MOV files.

    I have download travels from my KODAK digital camera.  Him are "transformed". MOV files.  Him will not properly play using WINDOWS MEDIA PLAYER (windows 7).  That is, the audio play... no video playback.  I need to download REALPLAYER?

  • Not able to access the Documents or control panel

    WINDOWS EXPLORER Whenever I try to open DOCUMENTS or control PANEL, he appears and says WINDOWS EXPLORER has SROPPED to OPERATE. It will say then it checks for a solution and restart without having to open the files. I tried restoring the system retu

  • BlackBerry Smartphones BlackBerry Protect for BB Torch

    Hello, I'm moving from a BB Torch 9810 to another BB Torch 9810 (nine). I downloaded the BB Protect to the new, and when I open it to restore the data that I had saved from the previous phone it shows a box saying that "the service plan for your BB d