find the highest in equal to the data

Hello
I need to find the top tied at the rank of gvien to the sort order for each grade is also given
could you please help me in the present.
with t1 as 
(select 'AB' t1_cd , 'A+' t1_rk from dual union all
select 'BC','BBB-' from dual union all
select 'CD','B-' from dual union all
select 'DE','AA' from dual union all
select 'EF','BB+' from dual),
 t2 as
 ( select 'AB' t2_cd ,'A+' t2_rk, 1 ordr FROM DUAL union all
   select 'AB' , 'A'  ,1 FROM DUAL UNION ALL
   select 'AE' ,'BBB-',3 from dual union all
   select 'BC' ,'BBB-',4 from dual union all
   select 'CD' ,'B-'  ,5 from dual union all
   select 'DE' ,'AA'  ,2 from dual union all
   select 'EF' ,'BB+' ,6 from dual )
SELECT * FROM T1,T2
WHERE t1.t1_cd= t2.t2_cd   -- I need to find the  code and rank which have rank greater than equal to BBB-   
Here, in the above query, I need to find records that have classifications > = 'BBB-' sort order is alos in the ordr T2 table column

Output expected
T1_CD     T1_RK     ORDR                            final_Rk

AB     A+     1  < BBB- i.e;4 so output  L
AB     A+     1  < BBB- i.e;4 so output  L
BC     BBB-     4  = BBB- i.e;4 so output  E
CD     B-     5  > BBB- i.e;4 so output  H
DE     AA     2  < BBB- i.e;4 so output  L
EF     BB+     6  > BBB- i.e;4 so output  H
Thank you

Published by: Smile on May 8, 2012 07:36
with t1 as
(select 'AB' t1_cd , 'A+' t1_rk from dual union all
select 'BC','BBB-' from dual union all
select 'CD','B-' from dual union all
select 'DE','AA' from dual union all
select 'EF','BB+' from dual),
 t2 as
 ( select 'AB' t2_cd ,'A+' t2_rk, 1 ordr FROM DUAL union all
   select 'AB' , 'A'  ,1 FROM DUAL UNION ALL
   select 'AE' ,'BBB-',3 from dual union all
   select 'BC' ,'BBB-',4 from dual union all
   select 'CD' ,'B-'  ,5 from dual union all
   select 'DE' ,'AA'  ,2 from dual union all
   select 'EF' ,'BB+' ,6 from dual )
SELECT t1.*, t2.*,
            case when t2.ordr > t3.ordr then 'H'
                   when t2.ordr = t3.ordr then 'E'
                   when t2.ordr < t3.ordr then 'L'
            end code
FROM T1,T2, (select max(ordr) ordr from t2 where t2_rk = 'BBB-') t3
WHERE t1.t1_cd= t2.t2_cd;

T1_CD T1_RK T2_CD T2_RK       ORDR CODE
----- ----- ----- ----- ---------- ----
AB    A+    AB    A+             1 L
AB    A+    AB    A              1 L
BC    BBB-  BC    BBB-           4 E
CD    B-    CD    B-             5 H
DE    AA    DE    AA             2 L
EF    BB+   EF    BB+            6 H   

6 rows selected.

Tags: Database

Similar Questions

  • How to find the date item was my favorites on Mozilla Firefox

    on system moot bookmark how to find the date of the bookmark?

    In bookmarks menu select organize bookmarks to open the bookmarks library. In the bookmarks library, click views, and then display the columns and then added. This will display a column showing when a bookmark has been added.

  • Toshiba 40TL938G - find the date and time settings

    I have a 40TL938G and I can't find the date and time settings.
    Can someone help me?

    SSY
    I read the manual and it does ' t say anything about these settings.

    THX

    In the settings of digital television, you should see the option called local time settings

    To display the time on the TV you press the sign of the small clock on the remote control while watching a normal TV show (analog only)

  • HP g62-340us: FIND THE DATE OF MANUFACTURE for a HP G62-340US?

    How to find the date of manufacture on my HP G62-340US

    Ken

    Hi, Ken

    This means that your laptop has built in 2011 (1) in the 2nd week of the calendar year (02) or January 2011.

  • How to find the date of purchase of my windows?

    I don't know the Date of purchase of windows, I can find it using the product key? or another procedure?

    Really, there is no way to find the date of purchase by using a Windows installed, Windows Installer CD or product key.   You need to find the original "Bill" room, you bought your computer or Windows.

  • where do you find the date of purchase on your computer

    Im trying to upgrade to windows 7, but it asked for the date of the purchase I don't have reception more and then I try again, it said that it is inelegible because he already has my serial number

    Hello Jonesejeans,

    Thanks for posting on the Community Forums of Microsoft Vista.

    Since you have lost the receipt of purchase of the computer, to get the date of purchase of the computer, you will have to contact the manufacturer of the computer and check the same.

    In Windows, you will not be able to find the date of purchase of the computer.

    However, you can find the date of installation of Windows on your computer that could help you.

    To find the date of installation of Windows on your computer, follow the steps below:

    1. Click on start and open computer.
    2. Click on the C drive and right click on the Windows folder.
    3. You can find the created Date of Windows folder.

    It will be useful.

    Thank you and best regards,

    Srinivas

    Microsoft Answers Support Engineer

    Visit our Microsoft answers feedback Forum and let us know what you think

  • I have an old Mac Book and need to find the date he did to see if I can improve

    Can someone tell me how to find the actual date that my old MacBook has actually been paid. I don't remember if it was 2006 or 2007. 10.6.8 runs and I want to spend to 10.9. Any help much appreciated.

    Thanks, DJ

    Go to the Apple in the upper left corner of any window, then 'about this Mac' and 'more information... "Copy and paste the information here, but omit the serial number and UUID (if present) material.

    You can also search on the everymac.com website specifications

  • AppleScript to find the date of the file

    I would like to have some sort of applescript or automator action to find the finder items that have date of today in them (ideally a single file). The record, I would like to draw is shown below. Any help would be appreciated.

    https://www.dropbox.com/s/j6erltponee7ox4/file.PNG?DL=0

  • average of k: how to find the data clustred; : or how to assign number t0 each data group

    Hi Member

    I have download the LabVIEW Machine https://decibel.ni.com/content/docs/DOC-19328 learning package

    I want to run the K average algorithm to group the image in a group of two or three or more

    the problem is how to find the result I mean the image of clustred', the image that contain 2 or three threatened value only

    or how aasign a 1 value for all the intesity who

    belong to the cluster a and 255 for data that belongs to group 2

    for the look of the image as binary image?

    a my vi below

    Best regards

    my post before shows how to set the threshold manually using the slider of the graph.

    Here is the version k-means automated help .vi box tools

    Alex

  • I can't find the "date modified" by downloading files to websites

    When I try to upload files to various sites, I can't find the "change date". Usually, I have the 'update' so that the last file that I worked on is on the top of the list and I quikly find.

    I checked on three different sites and each of them, when I go to browse the file to download, the "modification date" don't appear in the search window, and I have to type the name of the file, or scroll through the file to find.
    I can't find the "change date".

    See if you can right click on a column label to find add columns.   Necessary in Windows Explorer.

    OK... found it... for some reason when I had it on large icons, he wasn't showing me it... i changed large icons for details... and when I right click I saw ' sort by ' and then 'update'... after I clicked on update he showed on the column.

    My last OS is Vista and it's always right there, or I had to top of the window to do a right click
  • Find the date in clob data

    Hi all

    In the abc table, I would find the Id name if any later date is available in the variable 'data' (CLOB data type).

    I'm not able to go forward. can someone help me

    Output must be Id 102 and 103, the date indicated is greater than the current date.

    with abc as

    (

    Select 101 as id, 'Prime Minister arrived in Melbourne for the last leg of his tour of four cities in Australia on March 1, 2014 "as double data

    Union

    Select 102, "the prior reading of Singapore third quarter December 1, 2015 showing no response" of the double

    Union

    Select 103, ' there is no symptom of Malaria after December 15, 2104 meaning vaccine properly work ' from dual

    )

    Select * from ABC

    where the data like "trunc (sysdate) %.

    Thanks in advance

    This model ' [(0123456789)] + [()] + ((Jan) |) () Feb) | (Mar) | (APR) | (May). (Jun) | (Jul) | (August). (MS) | (Oct) | (Nov). (Dec)) [()] + [(0123456789)] +' finds the appropriate data now or later, does not matter.  We can use this model.

    use regexp_count with this model.  regexp_count returns "there are how many days" to open this model.

    using regexp_count for your sql output:

    ___regexp_count___ your data                                                              

    2 Prime Minister arrived in Melbourne, for the last leg of his tour of four cities in the Australia, March 1, 2014 and April 3, 2100
    2 The r1eading of 234/12 ahead of Singapore December 1, 2012, for the third quarter on December 1, 2015, showing no response
    1 There is no malaria symptom Minister after November 19, 2014 meaning vaccine properly work

    help link for regexp: Oracle of regular Expressions

    hope this helps

    Celal Ozdemir

  • How to find the date of a table Max

    Hello world

    I have two tables in the database. I want to find the maximum routine for a case_id of the lock_date date between jan 20 to January 29, 2012.

    But I don't get real output (output routine_date should be 'January 28, 2012' but I m getting "January 31, 2012" ")

    Can someone help me where I made the mistake


    Master
    case_id lock_date
    101 23 January 2012
    101 January 24, 2012
    102 27 January 2012
    102 January 29, 2012
    101 30 January 2012
    101 January 29, 2012

    Routine (for current work)
    case_id routine_date
    101 23 January 2012
    103 28 January 2012
    102 21 January 2012
    102 January 29, 2012
    101 21 January 2012
    101 28 January 2012
    101 31 January 2012


    Select m.case_id, r.routine_date from master m, systematic r,
    (case_id, max (routine_date) of the systematic group by selecting case_id) rr

    where m.case_id = r.case_id
    and m.case_id = rr.case_id
    and r.routine_date = rr.routine_date

    Hello

    Here are average dradles:

    WITH     universe  AS
    (
         SELECT    m.case_id
         ,        r.routine_date
         ,       MAX (r.routine_date)     OVER (PARTITION BY  m.case_id)
                         AS max_routine_date
         FROM       master       m
         ,        routine       r
         WHERE        m.case_id       = r.case_id
         AND       m.lock_date       >= TO_DATE ('20-Jan-2012', 'DD-Mon-YYYY')
         AND       m.lock_date       <  TO_DATE ('30-Jan-2012', 'DD-Mon-YYYY')
    )
    SELECT       case_id
    ,       routine_date
    FROM       universe
    WHERE       routine_date     = max_routine_date
    ;
    

    You only want to view rowss whose routine_date is the maximum date in a subset. First get this subset
    If the universe of data that you are interested in is just the period from January 20 to January 29, then you can start by getting all the data in this range. This is what the above subquery universe.
    Now, you want to see only the rows where routine_date is the max_routine_date within this universe, for each case_id. You can use the analytic MAX function to find out what this max_routine_date.
    Published by: Frank Kulash, March 2, 2013 11:59

  • With the help of several key values to find the data

    Hello, it's me again.

    I had a question out about data from database and display them on a page of the ADF on Jdev 11.1.1.3.

    And Mr. Daniel Atwood answered my question with this blog to follow, that wrote.
    http://www.avioconsulting.com/blog/datwood/2012/06/19/using-BPM-process-variable-ADF-form-retrieve-database-information-0.

    But I have another question on top that.

    The Mr.Atwood example is when using a value of key 'one', what happens if I have two key values, how to set?

    Here are some details:

    I have a table like this

    ID Type_code name
    0001 05 a-blabla
    0002 b 25-blabla
    0002 26 b-blabla
    0003-08 c-blabla
    0003 25 c-blabla
    0003 c 79-blabla

    What I want to do is after the entry of the ID (0003) and type_code (25), he will show me the result on three components of text entry in the ADF with the value 0003, 25 page and c-blabla.

    Currently, I use only ID to query the data, but I would use two key values to find specific data.

    Thank you very much for taking the time to think about it,

    Sincerely,

    Alto

    If you had multiple values to use for the request, one approach would be to create a display object. Whether you are creating the view object, in step 6, you will add two bind variables. Call a "pTypeCode" and call the other "pId". Click on the back button so that you're still in step 5, and modify the WHERE clause as follows:

    (ID = :pId) and (Type_code = :pTypeCode)
    

    After you have done this, double-click the Module of the Application and add your new view object. In the tab control of data, click the Refresh button. Expand your new view object tab of data control-> expand "French"-> note that you now have a new method called "ExecuteWithParams".

    Open your workflow diagram-> delete your existing "SetCurrentRowKeyValues" method-> made slide on your new "ExecuteWithParams" operation on the diagram. When you do so, you should see two settings you need to complete the dialog box. Just as you did before with the SetCurrentRowKeyValue method, set the values for the pTypeCode and the nest.

    Add the case of control flow of the new method to your existing view-> make the new method, the default value.

    On your form, remove the fields that have been placed here who uses the old object from view. On the tab of data control, drag the fields you want to be placed on the inside of your new view object form.

    Dan

  • Cannot find the data control to the Web Service in the Menu

    Hello

    I try to call a web service in the ADF. To do this, I want to create a web service data command

    If I understand correctly, if I right click on the template project, I see the data control from the Web Service under layer Business > Web Services. (as indicated in 2.1 Sec-http://www.oracle.com/technology/products/jdev/howtos/1013/wsadf/adfcomplexwstypes.html#WsProxyPojoControl)

    However, I am not able to find this entry in there.

    I tried the following things:

    I tried with Jdev 10.1.3.5, 10.1.3.4 and 10.1.3.1
    I tried to select all available models of technology to create applications
    -Any model
    -Web Application [JSF, EJB, Toplink]
    -Web Application [JSF, ADF]
    -Web Application [JSF, EJB
    -Web Application [JSF, Struts, ADF]... .and everthing else...

    I still don't see the web service proxy.

    Then I opened the ADFToystore sample application, and I could see the service data Web controls here!... .that mean my jdev is not defective... something else is missing.

    So, I tried to see what libraries are selected... I saw that a library named 'Web Service Data Control' are there in the project, which is not there in the model applications project that I created. So I added this library to the project, but it still does not work...
    Next, I added all THE libraries I have seen in the libraries in the project properties section... still no luck

    I don't know I'm missing something basic. Can someone please help.

    Rgds,
    Amit

    Hi Amit,

    try to set the filter above in New Gallery to filter by: all Technologies

    Kind regards

    Branislav

  • How to find the Date and the time of Installation of Oracle on Windows?

    Hello

    Is it possible to find the installation Date and time of Oracle on Windows?


    Concerning
    Rajesh

    If you have never recreated/restored/reincarnated the database, then COLUMN of v database $ should tell you when you created the database.

    If you are looking for the time of installing Oracle home, check the logs under OraInventory.

    Reply by Satish sir at the following link:
    installation of a database date/time!

    HTH
    Girish Sharma

  • How to find the date that a bookmark was made?

    It does not work:
    Go to the Menu bookmarks > show all bookmarks, then click Date of visit, top right middle.

    The visit Date column is just blank.

    If you want that the date on which the bookmark was created, then you have the added column.

    Make sure you keep the history and are not in private browsing mode in the visits column is empty.

Maybe you are looking for

  • Problem adding second e-mail in Thunderbird

    I have two emails, both from Gmail. I was able to add one successfully but when I try to add the other one can't. I get the message 'user name' or invalid password. I know that I entered both correctly, as I went to Gmail and connected with success h

  • I don't want my recently closed tabs to be saved... Any way to prevent this?

    It's been a long time I used Firefox (got a Macbook and for some reason any just used Safari for a long time), so please forgive me if I am just missing something in the settings of Firefox. Anywho, I have Firefox put in place to remember not my stor

  • Cannot install Driver Ethernet on my Equium A100-147

    I'm trying to install my ethernet drivers and drivers that I got on the site, apart from not being able to access them on Sunday they do not work, windows does not pick up them and there seems to be no installation/configuration file? Please can some

  • Préallouée VI environment in paralleled for loop

    Hello I searched a bit and couldn't find that everything about this specific issue. If I have a Subvi in a parallelized for loop and the Subvi is set upon reentrant preallouee clone, the Subvi register also several characteristics of memory depending

  • ACER Aspire 5742 i5 with 16 GB of RAM?

    Hello I have an Acer Aspire 5742 i5 model, now with 8 GB of RAM. I tried to install the two 8 GB DDR3 modules, but the machine will not work. It will boot, but crashes on Ubuntu when I connect. I tried memtest86 and it crashes almost immediately. I'v