Find the best rankings

Hello
I have the data and the following tables where I need to know the highest rank.
create table test_sort (rk_cd ,rk_ord   ) as
(select 'ZZZ',1 from dual union all
select 'ZZZ+',2 FROM DUAL union all
select 'KK', 3 FROM DUAL)

create table test_test1 (tst_cd )
as 
(select 'ZZZ' from dual union all
select 'ZZZ+' from dual)

I tried the following query but not giving me the expected out put  i.e; ZZZ+

select tst_cd from test_test1
where EXISTS (select rk_cd from test_sort where rk_ord = (select max(rk_ord) from test_sort WHERE tst_cd=rk_cd ))
AND TST_CD IN ('ZZZ','ZZZ+')
I don't have to put the rk_cd condition in ("zzz", "zzz +")

Could you help me
Thank you

Published by: Smile on June 15, 2012 07:22

Hello
This will give you the tests combined with the order

with test_sort as (select 'ZZZ' rk_cd,1 rk_ord from dual union all
select 'ZZZ+',2 FROM DUAL union all
select 'KK', 3 FROM DUAL)
,test_test1 as (
select 'ZZZ' test_cd from dual union all
select 'ZZZ+' from dual)

select
  test_cd
, rk_ord
from
test_sort
join
test_test1
on test_cd = rk_cd

TEST_CD     RK_ORD
ZZZ     1
ZZZ+     2

to discover the best tests, try

with test_sort as (select 'ZZZ' rk_cd,1 rk_ord from dual union all
select 'ZZZ+',2 FROM DUAL union all
select 'KK', 3 FROM DUAL)
,test_test1 as (
select 'ZZZ' test_cd from dual union all
select 'ZZZ+' from dual)

select * from (
select
  test_cd
, rk_ord
, rank() over (order by rk_ord desc) rnk
from
test_sort
join
test_test1
on test_cd = rk_cd
)
where
rnk = 1

TEST_CD     RK_ORD     RNK
ZZZ+     2     1

concerning

Tags: Database

Similar Questions

  • Hello, how can I find the best internet connections for my windows seven? I use my cell phone internet phone with a usb cable.is there any software from microsoft to help me?

    Hello, how can I find the best internet connections for my windows seven? I use my cell phone internet phone with a usb cable.is there any software from microsoft to help me?

    Hello

    The fastest internet connection depends on your internet speed provided by her Internet (ISP) Service provider. Therefore, contact them to receive a best speed of the internet.

    For more information:

    How to increase the speed of navigation: 7 ways to work faster on slow connections

    http://www.Microsoft.com/atwork/remotely/connections.aspx#fBid=TN-_TCHYDMB

    10 tips to help improve your wireless network

    http://www.Microsoft.com/athome/Setup/wirelesstips.aspx#fBid=1vrPRuhAhAg

    Internet Explorer is slow? 5 things to try

    http://Windows.Microsoft.com/en-us/Windows/help/Internet-Explorer/slow-five-tips-to-boost-performance

    It will be useful.

  • Where to find the best AE tutorials for beginner?

    Where to find the best AE tutorials for beginner?

    Getting started with After Effects (CS4, CS5, CS5.5, CS6, & CC). After the effects of interest area

  • Find the best modem / router configuration.

    Be 'stuck' with wimpy CenturyLink DSL service (read 4 Mbps), I try to get every ounce of speed that I can with my configuration of a Wi - Fi. The material in question is a Technicolor C1100T modem/router/WiFi and a current model Apple AirPort Extreme.

    The question is, whose Setup is faster:

    [A] C1100T in Bridge Mode (i.e. modem only) > AirPort Extreme all the PPPoE router / WiFi work, or

    [B] C1100T modem handling / PPPoE - router work > AirPort Extreme in Bridge Mode, just do a Wi - Fi connection?

    The C1100T goes only up to speed "n" where the Airport manages 'ac '. So my thought is the configuration 'B' may have an advantage. I thought I would ask the collective wisdom of the community of Apple before playing with all the related parameters. Speaking of which, overall the Apple hardware, the PPPoE "Account name" is always shown as formatting as an email (e.g. [email protected]) address. In the C1100T admin settings, the PPP username (PPPoE) is in the format ABC123456789. Formats in the case of AirPort Utility parameters (i.e. it will accept Qwest format)?

    As long as we talk about press speed, are there any other tricks, for example by selecting the best channels 2.4 GHz and 5 GHz (assuming that one is faster than the other)? Literally, living in the Woods, there is no one else around with any related Wi - Fi signal to interfere.

    As always, thanks for the help!

    The question is, whose Setup is faster:

    [A] C1100T in Bridge Mode (i.e. modem only) > AirPort Extreme all the PPPoE router / WiFi work, or

    [B] C1100T modem handling / PPPoE - router work > AirPort Extreme in Bridge Mode, just do a Wi - Fi connection?

    Not trying to be cute here, but if the products work correctly, the results will be the same.

    However... speed could be one thing and another reliability.  Setting PPPoE Apple are old and is not known for their reliability.  As you know, in theory, you want the device that provides identification of connection information to connect directly to the Internet service.  This would mean that have C1100T PPPoE c would probably be a better way to do things, reliability wise.

    The C1100T goes only up to speed "n" where the Airport manages 'ac '. So my thought is the installation of 'B' may have an advantage

    Not in terms of connection to the Internet.  If you are thinking about speed on your local network, the airport would be the way to go. Just ignore the C1100T, or turn off the wireless feature if you feel that it can interfere with wireless the wireless AirPort.

    Speaking of which, overall the Apple hardware, the PPPoE "Account name" is always shown as formatting as an email (e.g. [email protected]) address. In the C1100T admin settings, the PPP username (PPPoE) is in the format ABC123456789. Formats in the case of AirPort Utility parameters

    No, but I would not use PPPoE over airport.  If you have tons of time and be ready to experiment and put up with connections, more broken then you could try PPPoE on the airport.

    As long as we talk about press speed, are there any other tricks, for example by selecting the best channels 2.4 GHz and 5 GHz (assuming that one is faster than the other)?

    N ° the most convenient airport at startup, it automatically scans to select a channel that meets the criteria set by Apple engineers. As soon as it finds one, he chooses.

    If someone really knew what could be the real criteria you had tons of time on your hands, in theory, it may be possible to guess and select a channel as good as who will pick up the airport.

  • Where can I find the best free software to convert files audio .wma files .mp3 to my player?

    I have a MP3 player that I want to use to read audio books and that he cannot find a conversion program easy, good to convert .wma to .mp3 and then files files transfer to my MP3 player.  Help, please.

    Hello

    Welcome to the Microsoft community!

    I suggest you to search online using your favorite search engine to see what is the best free software to convert files audio .wma MP3 files for your MP3 player.

    THIRD PARTY LINK WARNING

    WARNING: Using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.

    Hope this information is useful.

    If you need more help on this question or if you have questions about Windows let us know.

    We would be happy to help you!

  • Trying to find the best route to buy Photo Shop CC.

    I already own a license to Lightroom 5.7.  It seems that Adobe doesn't have a plan purchase except Photo Shop CC for $20 / mo. But, if I buy the creative cloud which includes Photo Shop and Lightroom for $10 / month, although I already have the Lightroom license, I save me $ 10/month correct?

    So the only way I see is to buy Creative Cloud.

    Good as CC is subscription only $10 a month... is the best plan you can also download and install Lightroom, but that overhead is unnecessary. Your not forced to download Lightroom.

  • Try to find the best PC for a Mac Power PC

    My father has a Mac with OS 10.4.11.  It is a 800 MHz Power PC G4 with 768 MB of SDRAM memory.  Its latest version of the Flash Player is barely (video out image unique all few seconds) if we want to update so that he can watch You Tube and others.   We went to the page to install a new version that would work with OS 10.4 and received an error message saying that the FP version can not be installed as Power PC are no longer supported.

    I then found what seems to be the right version: 10.1.102.64.   But when I tried to download it, it gave me a complete file of icons with weird tags - .qz, .bz2, .zip, .exe, I do not understand.

    Can someone lead us in the right direction?  We use our Safari browser (version 4.0.4 - old kinda, I think - could have something to do with it?).  We are simply the best version of the PC that will work with this set - up.  If 10.1.102.64 is the best, how to operate once I press 'download '?  Thank you.

    You must use the one that has 'mac' in the name and a .dmg extension.

  • Find the best way

    Hi all: after reading these articles, I could walk the circumference of a cheerio in half an hour. Well here it is

    With all of these programs to do what we want. Well, I chose Acronis then what is the difference between the perception of the copy; The cloning.

    Hello, kmann.

    Then, first I must point out that different providers define things a little differently. They are not far from each other, but in the end, it's really easy to get lost in the terminology from one vendor to another.

    On this basis, I felt I should do a little research of the good people of Acronis and found that they had a large enough base of knowledge (kb).

    This is the closest thing that I could find an answer to your question:

    KB.Acronis.com/.../1540

    So, in short, cloning IS copy and a "clone" is a copy of their definition. However, they distinguished a clone and a backup. (as explained in this article)

    I hope that answers your question.

    Have a great rest of the day!

  • Help to find the best way to interior design (Nested Loops of sliders?)

    Oracle 11G

    First here the table I work with, for example data

    ID FID ANNOTATION DESIGNATION LOW HIGH SEQ
    11008755360FC1053, 81-82FC105381821
    21008755360XD, 3-24XD3242
    31008756293FC1053, 81-82FC105381821
    41008756293XD, 3-24XD3242

    Each FID is a different line, these two lines are connected physically, that's why I've shown them here on the table. Each line has a 'meter', in this case, each line has 2 lines of account that are the same.

    cableExample.png

    From there, we can say that FC1053, 81 and 82 are connected between the 2 cables. XD DESIGNATION means that cables are connect not really so I can't ignore those.

    We have a different way to show that they connect other than only those data and I need to connect each other too much. For this I need the Info

    FID1 LOW HIGH FID2
    100875536081821008756293

    So my first design was the hepatitis hase sliders 2 with the data in the table, as shown above. I would then have a nested loop. The first slider to select the first record, then go down to the second loop where I compare all other records the first record and then go back in the outer loop to move to the next record, then return once again to the inner loop to compare the values again.

    LOOP1

    LOOP 2

    If LOOP1. IDF! LOOP2 =. IDF THEN

    IF LOOP1. ANNOTATION = LOOP2. ANNOTATION THEN

    -CONNECT THE DATA

    ON THE OTHER

    IF LOOP1. DESCRIPTION = LOOP2. DESIGNATION THEN

    IF LOOP2. LOW BETWEEN LOOP1. LOW AND LOOP1. THEN HIGH

    IF LOOP2. HIGH BETWEEN LOOP1. LOW AND LOOP1. HGH THEN

    -CONNECT THE DATA

    END IF;

    END IF;

    END IF;

    END IF;

    END IF;

    END LOOP;

    -Open and close done to reset the cursor to the front/top

    CLOSE CURSOR LOOP2;

    OPEN CURSOR LOOP2

    END LOOP;

    The problem with this approach is once the outside loop moves the next value of the IDF, that logic will connect them once again, but this time with the FIDs reverse which is essentially the same thing as it does not matter the direction in which they are connected. I almost feel that once I found the link I need to remove that line from the cursor (which isn't possible).

    FID1 LOW HIGH FID2
    100875536081821008756293
    100875629381821008755360

    I was able to

    1. make a list of all those I have connected and check against that

    2 use some kind of collection

    3. use a temporary table to hold the data

    4 something that I have not yet thought

    I really appreciate in advance for any help I get.

    If your query mapping is correct, this is the result of your query with the addition of the values of sum for the strand/down running.  Manually change the incorrect in the output bit numbers so that we can move on to find another solution.

    with gc_count like)

    Select

    Sum(current_high-current_low+1) on strand_high (g3e_fid seq order partition),

    Sum(current_high-current_low+1) more (partition of g3e_fid order of seq).

    strand_low (current_high-current_low),

    t.* from b$ gc_count t

    )

    Select

    a.g3e_fid, a.current_designation, a.current_low, a.current_high, a.strand_high, a.strand_low,

    b.g3e_fid, b.current_designation, b.current_low, b.current_high, b.strand_high, b.strand_low

    gc_count a, gc_count b

    where a.g3e_fid in (1008757155,1008757159,1009999655)

    and in b.g3e_fid (1008757155,1008757159,1009999655)

    and a.g3e_fid > b.g3e_fid

    and ((a.count_annotation = b.count_annotation)

    or (a.current_designation = b.current_designation

    and a.current_low b.current_low and b.current_high and a.current_high between b.current_low and b.current_high)

    order of b.seq

    /

    G3E_FID CURRENT_DESIGNATION CURRENT_LOW CURRENT_HIGH STRAND_HIGH STRAND_LOW G3E_FID CURRENT_DESIGNATION CURRENT_LOW CURRENT_HIGH STRAND_HIGH STRAND_LOW

    ---------- --------------------- ----------- ------------ ----------- ---------- ---------- --------------------- ----------- ------------ ----------- ----------

    GAGA GAGA 1008757159 1008757155 1 1 2 2 1 2 2 1

    1008757159 3 8 8 3 1008757155 3 8 8 3 F1DM F1DM

    1008757159 9 10 10 9 1008757155 9 10 10 9 F2 F2

    1008757159 11 14 14 11 1008757155 11 14 14 11 F1DM F1DM

    1009999655 17 18 6 5 1008757155 15 18 18 15 F2 F2

    1008757159 15 16 16 15 1008757155 15 18 18 15 F2 F2

    1009999655 21 24 4 1 1008757155 21 24 24 21 F2 F2

    7 selected lines.

    Elapsed time: 00:00:00.06

  • find the best way to learn and begin to

    Hello all, I am a coach and I wonder If I special offer. In other words, I am self-employed working for services of consultants et training academies. I can find a special This is not to provide expensive. I want to use le programs to learn and be able in the future for training on them.

    If you are a student or teacher, you may be eligible for the education discount, Adobe - Adobe Education Store: proof of academic identification

  • Need help to find the best online tutorial site

    Could it please send a best PLSQL online tutorial site.

    Advance thanks to you all.

    Please visit this site
    Always good to visit the official oracle for reference.

    http://docs.Oracle.com/CD/E11882_01/server.112/e26088/TOC.htm

    ~ Franck

  • How to find the best log of SQL in the responses of the OBI?

    While I have an error by a request of the OBI in answers page, the error message in the result tab is usually not very useful, as:
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27005] Unresolved column: "Sales Facts Current Month"."Amount Sold (000) Current Month". (HY000)
    SQL Issued: {call NQSGetQueryColumnInfo('SELECT "Sales Facts Current Month"."Amount Sold (000) Current Month", "Sales Facts"."Amount Sold", Calendar."Calendar Month Desc", Calendar."Calendar Month Name", Products."Prod Category" FROM SH')}
    
    SQL Issued: SELECT "Sales Facts Current Month"."Amount Sold (000) Current Month", "Sales Facts"."Amount Sold", Calendar."Calendar Month Desc", Calendar."Calendar Month Name", Products."Prod Category" FROM SH
    I then go to the Session Monitor and click the view log. By doing so, sometimes, I got the complete sql statement. It is good and I can understand the problems. Sometimes, I have things like:
    -------------------- SQL Request:
    SET VARIABLE QUERY_SRC_CD='Report',SAW_SRC_PATH='/shared/sh/Learn';SELECT Times."Calendar Month Name" saw_0, Times."Calendar Month Desc" saw_1, Products."Prod Category" saw_2, Salesfacts."Amount Sold" saw_3, REPORT_SUM(saw_3 BY saw_0, saw_1), REPORT_SUM(saw_3 BY ) FROM SH WHERE (TOPN(Times."Calendar Month Id",40) <= 40) AND (Channels."Channel Desc" = 'Direct Sales') ORDER BY saw_1, saw_0, saw_2
    
    +++Administrator:13290000:1329000f:----2009/09/29 09:18:33
    -------------------- General Query Info:
    Repository: Star, Subject Area: SH, Presentation: SH
    +++Administrator:13290000:1329000f:----2009/09/29 09:18:33
    -------------------- Cache Hit on query:
    Matching Query:     SET VARIABLE QUERY_SRC_CD='Report';SELECT Times."Calendar Month Name" saw_0, Times."Calendar Month Desc" saw_1, Products."Prod Category" saw_2, Salesfacts."Amount Sold" saw_3 FROM SH WHERE (TOPN(Times."Calendar Month Id",40) <= 40) AND (Channels."Channel Desc" = 'Direct Sales') ORDER BY saw_0, saw_1, saw_2
    Created by:     Administrator
    It is not enough that the selected tables are not entirely clear on. It appears like it find OBI the sql in the cache and process the request entirely.

    Is there a way I can force return OBI demand? Is there a way to get OBI newspaper the complete sql statement? This way I can copy the SQL to SQL * more and find exactly the problem

    Thank you.

    Physical SQL is not visible because it hits the cache.
    You can:
    (1) clear RPD physical cache and run the query again.
    or
    (2) copy the SQL logic, go to web Admin - number SQL - paste the SQL logic, then just change a setting or two, so it does not hit the cache. For example, to change a filter to Jan Feb... or just add a dummy column initially as select 1 or select 'a'... .rest of sql even.

    in this way, you can avoid hitting the cache and see the sql code (at the bottom of the results - view the journal)

    Make sure that you have enabled the option to cache presentation server and define the level of logging to 4 or more to see the details.

    HTH

  • Where do you find the best deals on CF / SD cards?

    I currently use Amazon in tandem with Camelcamelcamel.com to monitor the prices of some of the cards that I look at. I have followed deals.woot.com to see if something new comes up.
    Does anyone else have any suggestions or tips for places to visit for the deals on memory cards?

    Thank you!

    Go to DaWanda.com they post the new SD/CF card every day. You can search in there. I know there is a ranging at Adorama now agreement for card SD Sony.

  • Weather for blackBerry Smartphones need help to find the best App

    I need to download the Besst Weather app I want the weather icon to show in good detail the snow, rain, clouds, in GOOD DETAIL nice please good list I would really appreciate it

    BeWeather is the most award-winning weather app and should do the trick for you:

    http://appworld.BlackBerry.com/WebStore/content/1062/?lang=en

    It also comes in a free version:

    http://appworld.BlackBerry.com/WebStore/content/5350/?lang=en

    I use WeatherEye weather network:

    http://appworld.BlackBerry.com/WebStore/content/1191/?lang=en

    I hope I've been helpful to you.

  • Where is the best place to find information on the new version of product releases for Windows, Internet Explorer and SQL Server?

    Hi, we would like to ensure that we are aware and actively involved in the preparation and planning in support of our product lines using the newest and the most innovative platforms and those whose primary Microsoft - Windows, Internet Explorer and SQL Server products and would like to find the best and most reliable way to receive alerts about new products , version beta and official release information notification automatically either by subscription or other alert.

    Post in the Windows Server Forums:
    http://social.technet.Microsoft.com/forums/en-us/category/WindowsServer/

Maybe you are looking for

  • Re: Satellite A300-1MT: where to find the WLan driver?

    Hi all. I bought Satellite A300 1MT to May 12, 2009.After the first round on, installated Windows Vista.Device Manager is equipped with a device of ininstalled one with the name "Ethernet card", but the wireless network card no. I am in charge of the

  • Analog/digital VI

    Hello I use a digital converter analog VI. I see that VI, all parameters except the sampling frequency. An ADC must always come with like 10KSPS sample rate, 1mech. Can you tell me how to control the sampling frequency of the ADC. I have attached sna

  • HALO 2 PROBLEM

    Hi my name is sonny and I installed halo 2 and now it won't let not uninstall me IT... I'm looking for the file under search that says uninstall halo 2 and nothing comes up, but all the files for the game Halo. Help, please!...

  • How to include a document in email without being an attachment

    e-mail message I want to send an e-mail message and then include an entire document after him.  I don't want as an attachment.  How can I accomplish this? Thank you T:

  • 8 win fails to connect to the Agent to install all the Windows user

    Hello When I start Windows 8 I get a box saying cannot connect to a windows service. Windows all users install the agent service. Event ID 7000. If I'm on online help link I get "page not found". The result from my point of view is that I don't seem