Retruning lines which have the same return value from the function RANK

Hi, I want to achieve is to use a DENSE RANK function to identify the same value of the data, if the rank values are same then extra. Here is the code
WITH CTE AS
(
SELECT SalesPersonID,
SalesQuota,
DENSE_RANK() OVER (ORDER BY SalesQuota DESC) as DENSE_RANK
FROM Sales.SalesPersonQuotaHistory
WHERE SalesQuota BETWEEN 266000.00 AND 319000.00
)
This retrun
SalesPersonID SalesQuota DENSE_RANK
280 319000.00 1
287 304000.00 2
280 301000.00 3
282 288000.00 4
283 284000.00 5
287 281000.00 6
278 280000.00 7
283 280000.00 7
283 267000.00 8
278 266000.00 9
How I choose the rank value that are of the same value?

The result should be
278 280000.00 7
283 280000.00 7
with cte as
(
 select salespersonid,
     salesquota,
     dense_rank() over (order by salesquota desc) as dr
   from sales.salespersonquotahistory
  where salesquota between 266000.00 and 319000.00
)
select *
  from (
     select cte.*, count(*) over(partition by dr) ct
       from cte
       )
 where ct > 1

Tags: Database

Similar Questions

  • How to remove the lines that have the employee name double?

    Hello world

    Greetings

    I'm using oracle 11g.

    Suppose I have a table and I want to delete lines that have the name used twice?

    So given below is my table so I only delete lines that have more than one 'Ram' and 'Dilip' ename.

    How to do this?

    EmpID Ename salary Commission depnto
    101RAM50004531
    102RAM60007652
    103Sisi34568763
    104Dilip76566754
    105Mohan98787675
    106Dilip56469876
    107Ganesh98234557

    You can use a simple code as follows

    Delete From EMP

    Where rowid! = (select min (rowid) of the group by Ename EMP);

    For preserved older values using 'min (rowid)'

    and for the most recent values required use "max (rowid)"

    Thank you.

  • PCG 4A1L LAPTOP COMPUTER WHICH HAVE THE SYSTEM OPERATION

    Ideas:

    • PCG 4A1L LAPTOP COMPUTER WHICH HAVE THE SYSTEM OPERATION
    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem

    Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    I'm sorry to hear that. In a little more detail would be helpful. Crystal Ball (tm) says when you turn on the computer you get an error message that says somethng like "cannot find operating system". If Crystal Ball (tm) is correct, your hard drive is dead or your motherboard is a failure. Pull the drive and put it in a disk enclosure or use an adapter and test it on a working machine.

    http://www.elephantboycomputers.com/page2.html#Hardware_Tshoot

    If you can not do the test yourself and/or are uncomfortable opening your computer, take the machine to a professional computer repair shop (not your local equivalent of BigComputerStore/GeekSquad).

    If Crystal Ball (tm) was cloudy, please specify exactly what is happening with your computer. MS - MVP - Elephant Boy computers - don't panic!

  • 1 master authentication request. Without the need to have the function of authentication on each different schema.

    SCENARIO OF

    1 request to master.

    There the login page and the home page where you choose where you want to go. Your option are different applications.


    Currently, I have 2 other application you can choose from. Each is in his diagram on.

    My master application uses authentication even than these 2 apps. IM using the session cookie if you need to connect only once.

    Problem is that I have this auth function installed in the two schemas.

    I'm doing something wrong? Is it possible to have the function only auth installed on a diagram of the CONNECTION MASTER application. And apps for CHILD can be authenticated on the master APP.

    Para wrote:

    SCENARIO OF

    1 request to master.

    There the login page and the home page where you choose where you want to go. Your option are different applications.

    Currently, I have 2 other application you can choose from. Each is in his diagram on.

    My master application uses authentication even than these 2 apps. IM using the session cookie if you need to connect only once.

    Problem is that I have this auth function installed in the two schemas.

    I'm doing something wrong? Is it possible to have the function only auth installed on a diagram of the CONNECTION MASTER application. And apps for CHILD can be authenticated on the master APP.

    All requests must have an authentication scheme defined.

    • Create authentication features in a package in a DB schema and grant privileges of execution thereon to the others.
    • Create the authentication scheme in the main application.
    • Create authentication schemes in other applications or copies of the program in the main application by using the copy and subscribe option in the wizard. These programs will now reference the master schema and automatically to reflect the changes.
  • query to view separate lines that have the same values

    Hello

    I have the columns id, addr1, addr2, city and State of coding. I need to know all the coding IDS that have the same addresses and at the same time filter out the same side of the id of the request.

    For example:

    acctid addr1, addr2 City State

    WEF 1 101 101 sd

    1                         101          wef     sd

    WEF 2 101 101 sd

    WEF 3 101 101 sd

    DC 4 102 102 homeless

    From the above data, I want to get filter tier 4 and get lines 1, 2 and 3. How to achieve with a sql query

    Thank you

    Arch

    This has nothing to do with hard... coding is how you test a query without creating the table, so you'd:

    with match_finder AS (SELECT acctid, addr1, addr2, city, State, count (*) OVER (PARTITION BY addr1, addr2, city, province) AS identical_rows)

    OF )

    Select acctid, addr1, addr2, city, province

    of match_finder

    where identical_rows > 1

    /

    and the rest, I'm sure, you can find on your own...

    HTH

  • How to return values from the record following instead of in the same record in LOV

    Hi all

    I use Forms 10 G.

    I have a block of details. In what in the 3rd column, I have a LOV.

    My requirement is let say I asked for it from the 1st and 2nd column, and it shows 1 record.

    After that if I pressed F9, then it should display the LOV list and, when I select a value any then it will create a new record with the same value of 1st and 2nd column.

    Example: -.

    Agenda provider country
    123ABCIndia

    We here in the column 'Country' LOV. Then when I pressed F9 then Lov should be displayed.

    as below.

    List of countries
    India
    U.S..
    Japan

    It works very well so far.

    Now if I select from the USA in the list then it should create a new record with the values of 1st and 2nd column.

    Agenda provider country
    123ABCIndia
    123ABCJapan

    How can I do this?

    Besically I need, rather than return the value in the same record, he must return to the next with the exsiting values record.

    The algorithm is:

    -use the KEY-LISTVAL about to 'COUNTRIES '.

    -LOV execution using builtin show_lov

    -store the return value Lov any parameter or a local variable in your trigger code ( vL_dummy_Deger varchar2 (100); )

    -Create registration

    -assign value to any new item you want to

    code like this:

    declare

    vLDummy boolean;

    vL_dummy_Deger varchar2 (100);

    Start

    -lov runs lov ruturns value is assigned to all the dummy elements to store Lov, return value. (no need to display)

    "-" DUMMY "point lets store lov, return value.

    vLDummy: = show_lov ('LOV_ULKE');

    --

    vL_dummy_Deger: =: model;

    create_record;

    : new_item: = vL_dummy_Deger;

    end;

  • How can I get the top lines of the page, I have my toolbar back? The first line starting with 'file' on the right and the second line which contains the refersh button as well as the search bar disappeared. How to make a comeback?

    The first two lines of my toolbar disappeared. I find myself with most visited but the lines above, containing the button refresh, bookmarks, and search bar and above the one containing the links to the files, etc are passed, how do em back?

    == I was juggling the different bars and must have clicked smth, that I should not have.

    ALT V
    T
    M

    Don't forget to do this in a new empty tab.

  • Report based on the return values from checkboxes

    Hi guys,.

    I have a question about the boxes and a report.

    Is it possible to create a report based on a list of dynamic control, where I can score different points of the brand. for example:
    select * from table where colomn <> :PX_CHECKLIST
    With a radio group ii without problem and when I mark only 1 entry in the list of control that works too, but I would like to have the ability to mark more than one entry and validity of these marked entries that the report should be implemented...

    If anyone has an idea how to get account, please let me know.
    Should I create a box separated each entry area to be able to refer to them?

    Thank you
    Patrick

    Hi Patrick
    We are working on the same problem... ;-)
    I'spent 2-3 recent
    days attempted to understand how to treat the boxes in a tabular form
    Looks like you had the same problem
    My solution is...
    The checkox "ChkBox" returns the values 36:58:423:46:422:421 etc.
    This box is passed to a function of package 'GetEquipmentSql (ChkBox-online pArr2)"used s Source for a Pl/Sql statement

    Function GetEquipmentSql (pArr2 in Varchar2)
    Return Varchar2
    as
    When Varchar2 (2000);
    Wselectionnez Varchar2 (2000): = ' Select re. Room_Id, r.Name, Count (1) of Room_Equipment re, Hall r';
    Win a Varchar2 (2000);
    l_vc_arr2 APEX_APPLICATION_GLOBAL. VC_ARR2;
    BEGIN
    l_vc_arr2: = APEX_UTIL. STRING_TO_TABLE (pArr2);
    If l_vc_arr2.count > 0 Then
    FOR z IN 1.l_vc_arr2.count LOOP
    If z > 1 then
    Win: wIn = | ',';
    end if;
    Win: wIn = | l_vc_arr2 (z);
    END LOOP;
    Wselectionnez: = Wselectionnez | «where are.id = re.» Room_Id';
    If l_vc_arr2.count > 0 Then
    Wselectionnez: = Wselectionnez | ' and re.equip_id IN ('| win |') ' ;
    End If;
    Wselectionnez: = Wselectionnez | When;
    Wselectionnez: = Wselectionnez | "Room_Id group, r.name';
    Wselectionnez: = Wselectionnez | ' Having count (1) > = ' | l_vc_arr2. Count;
    On the other
    Wselectionnez: = "Select Room.Id, Name, 0 from Room;";
    End If;
    Return (wSelect);
    END;

    The function returns
    *' Select Re. Room_Id, r.Name, Count (1) of Room_Equipment re, Hall r where are.id = re. Room_Id and re.equip_id (36,58,423,46,422,421) GROUP of Room_Id, r.name'; *

    I did it the easy way, I showed you the code
    Do you understand my solution?
    / Gunnar

  • [JS CS4/CS5/CS5.5] How to get the return value from Javascript using doScript

    Hi all

    I'm calling javascript from COM (c#) and it works fine. Passing parameters to javascript and playback by using the syntax of the [x] arguments also works very well.

    What I can't seem to get to work is to know how to move something from javascript to the calling COM Summoner, in this case, c#. How and where should I place the return value in javascript?

    Thanks in advance.

    Rachiud

    doScript() evaluates an expression, so just make sure that your Javascript is an expression.

    For instance "(3 + 3)" 6 "

  • How to get the return value from Java runtime.getRuntime.exec?

    I am running shell from a (GR 11, 2) Oracle database commands on aix.
    But, I would get a return value of a shell comand... as you get with "echo $?"

    I use a code like
    CREATE OR REPLACE JAVA SOURCE NAMED common."Host" AS
    import java.io.*;
    public class Host {
      public static int executeCommand(String command) {
        int retval=0;
        try {
            String[] finalCommand;
            finalCommand = new String[3];
            finalCommand[0] = "/bin/sh";
            finalCommand[1] = "-c";
            finalCommand[2] = command;
    
          final Process pr = Runtime.getRuntime().exec(finalCommand);
          pr.waitFor();
    }
       catch (Exception ex) {
          System.out.println(ex.getLocalizedMessage());
          retval=-1;
        }
        return retval;
    };
    /
    but I do not get a return value... because I don't know how to get the return value...

    Published by: user9158455 on 22-Sep-2010 07:33

    Hello

    Your pr.exitValue () has tried?

    I think you also need a finally block that destroys the sub-process

    Concerning
    Peter

  • How to pass values from one function to the other

    Hello

    I am a school teacher and a beginner in Flash Actionscript. I am creating a countdown for use in my classroom during testing. The beginning and break according to need, but not the pause button functions. When I click on the pause button, the timer is reset to 0:00:00. Help, please. Here is the code that I had written so far:

    var Subject1timeLeftHr;

    var Subject1timeLeftMin;

    var Subject1timeLeftSec;

    Subject1start_btn._visible = true;

    Subject1pause_btn._visible = false;

    Subject1rotor_mc.gotoAndStop (1);

    Subject1rotor_mc._visible = false;

    Subject1durationHr_txt. Text = "0";

    Subject1durationMin_txt. Text = "00";

    Subject1durationSec_txt. Text = "00";

    Selection.setFocus (Subject1durationHr_txt);

    function SubjectdurationHr (SubjectxdurationHr_txt, SubjectxdurationMin_txt)

    {

    if (SubjectxdurationHr_txt.length == 1)

    {

    Selection.setFocus (SubjectxdurationMin_txt);

    }

    }

    function SubjectdurationMin (SubjectxdurationMin_txt, SubjectxdurationSec_txt)

    {

    if (SubjectxdurationMin_txt.length == 2)

    {

    Selection.setFocus (SubjectxdurationSec_txt);

    }

    }

    function SubjectdurationSec (SubjectxdurationSec_txt, SubjectxdurationHr_txt)

    {

    if (SubjectxdurationSec_txt.length == 2)

    {

    Selection.setFocus (SubjectxdurationHr_txt);

    }

    }

    Subject1durationHr_txt. OnChanged = function()

    {

    SubjectdurationHr (Subject1durationHr_txt, Subject1durationMin_txt);

    };

    Subject1durationMin_txt. OnChanged = function()

    {

    SubjectdurationMin (Subject1durationMin_txt, Subject1durationSec_txt);

    };

    Subject1durationSec_txt. OnChanged = function()

    {

    SubjectdurationSec (Subject1durationSec_txt, Subject1durationHr_txt);

    };

    function startcountdown (SubjectxdurationLeft, SubjectxdurationHr, SubjectxdurationHr_txt, SubjectxdurationMin, SubjectxdurationMin_txt, SubjectxdurationSec, SubjectxdurationSec_txt, Subjectxduration, SubjectxstartTime, SubjectxendTime, Subjectxtimer_mc, Subjectxpause_btn, Subjectxstart_btn, Subjectxrotor_mc, SubjectxtimeLeft, SubjectxtimeLeftHr, SubjectxtimeLeftMin, SubjectxtimeLeftSec, SubjectxtimeLeftHr_txt, SubjectxtimeLeftMin_txt, SubjectxtimeLeftSec_txt)

    {

    delete SubjectxdurationLeft;

    delete SubjectxdurationHr;

    delete SubjectxdurationMin;

    delete SubjectxdurationSec;

    delete Subjectxduration;

    delete SubjectxdurationHr_txt.text;

    delete SubjectxdurationMin_txt.text;

    delete SubjectxdurationSec_txt.text;

    SubjectxstartTime = getTimer();

    Subjectxtimer_mc.onEnterFrame = function()

    {

    if (SubjectxdurationHr_txt.text == Nan |) SubjectxdurationMin_txt.text == Nan | SubjectxdurationSec_txt.text is Nan)

    {

    }

    else

    {

    SubjectxdurationHr = 60 * 60 * 1000 * Number (SubjectxdurationHr_txt.text).

    SubjectxdurationMin = 60 * 1000 * Number (SubjectxdurationMin_txt.text).

    SubjectxdurationSec = 1000 * Number (SubjectxdurationSec_txt.text).

    Subjectxduration = SubjectxdurationHr + SubjectxdurationMin + SubjectxdurationSec;

    SubjectxendTime = SubjectxstartTime + Subjectxduration;

    SubjectxdurationLeft = SubjectxendTime - getTimer();

    if (SubjectxdurationLeft > 0)

    {

    SubjectxdurationHr_txt._visible = false;

    SubjectxdurationMin_txt._visible = false;

    SubjectxdurationSec_txt._visible = false;

    Subjectxpause_btn._visible = true;

    Subjectxstart_btn._visible = false;

    Subjectxrotor_mc._visible = true;

    Subjectxrotor_mc.play ();

    SubjectxtimeLeft = SubjectxdurationLeft / (1000 * 60 * 60);

    SubjectxtimeLeftHr = Math.floor (SubjectxtimeLeft);

    SubjectxtimeLeftMin = Math.floor ((SubjectxtimeLeft-SubjectxtimeLeftHr) * 60);

    SubjectxtimeLeftSec = Math.floor (((SubjectxtimeLeft-SubjectxtimeLeftHr) * 60 - SubjectxtimeLeftMin) * 60);

    SubjectxtimeLeftHr_txt.text = String (SubjectxtimeLeftHr);

    if (SubjectxtimeLeftHr_txt.length < 1)

    {

    SubjectxtimeLeftHr_txt.text = '0' + SubjectxtimeLeftHr_txt.text;

    }

    SubjectxtimeLeftMin_txt.text = String (SubjectxtimeLeftMin);

    if (SubjectxtimeLeftMin_txt.length < 2)

    {

    SubjectxtimeLeftMin_txt.text = '0' + SubjectxtimeLeftMin_txt.text;

    }

    SubjectxtimeLeftSec_txt.text = String (SubjectxtimeLeftSec);

    if (SubjectxtimeLeftSec_txt.length < 2)

    {

    SubjectxtimeLeftSec_txt.text = '0' + SubjectxtimeLeftSec_txt.text;

    }

    }

    else

    {

    delete Subjectxtimer_mc.onEnterFrame;

    SubjectxtimeLeftHr_txt.text = "";

    SubjectxtimeLeftMin_txt.text = "";

    SubjectxtimeLeftSec_txt.text = "";

    SubjectxdurationHr_txt._visible = true;

    SubjectxdurationMin_txt._visible = true;

    SubjectxdurationSec_txt._visible = true;

    Subjectxrotor_mc.gotoAndStop (1);

    Subjectxrotor_mc._visible = false;

    SubjectxdurationHr_txt.text = '0 '.

    SubjectxdurationMin_txt.text = "00";

    SubjectxdurationSec_txt.text = "00";

    Subjectxpause_btn._visible = false;

    Subjectxstart_btn._visible = true;

    Selection.setFocus (SubjectxdurationHr_txt);

    }

    }

    };

    }

    function pausecountdown (SubjectxdurationHr_txt, SubjectxtimeLeftHr, SubjectxdurationMin_txt, SubjectxtimeLeftMin, SubjectxdurationSec_txt, SubjectxtimeLeftSec, Subjectxstart_btn, Subjectxpause_btn, Subjectxrotor_mc)

    {

    delete Subjectxtimer_mc.onEnterFrame;

    SubjectxdurationHr_txt.text = String (SubjectxtimeLeftHr);

    SubjectxdurationMin_txt.text = String (SubjectxtimeLeftMin);

    SubjectxdurationSec_txt.text = String (SubjectxtimeLeftSec);

    Subjectxstart_btn._visible = true;

    Subjectxpause_btn._visible = false;

    Subjectxrotor_mc.stop ();

    }

    Subject1pause_btn.onRelease = function()

    {

    pausecountdown (Subject1durationHr_txt, Subject1timeLeftHr, Subject1durationMin_txt, Subject1t, imeLeftMin, Subject1durationSec_txt, Subject1timeLeftSec, Subject1start_btn, Subject1pause_btn, Subject1rotor_mc);

    };

    Subject1start_btn.onRelease = function()

    {

    startcountdown (Subject1durationLeft, Subject1durationHr, Subject1durationHr_txt, Subject1dura, tionMin, Subject1durationMin_txt, Subject1durationSec, Subject1durationSec_txt, Subject1durati, Subject1startTime, Subject1endTime, Subject1timer_mc, Subject1pause_btn, Subject1start_btn, Subject1rotor_mc, Subject1timeLeft, Subject1timeLeftHr, Subject1timeLeftMin, Subject1timeLeftS ec, Subject1timeLeftHr_txt, Subject1timeLeftMin_txt, Subject1timeLeftSec_txt);

    };

    Subject1cancel_btn.onRelease = function()

    {

    Subject1timeLeftHr_txt.text = "";

    Subject1timeLeftMin_txt.text = "";

    Subject1timeLeftSec_txt.text = "";

    Subject1durationHr_txt._visible = true;

    Subject1durationMin_txt._visible = true;

    Subject1durationSec_txt._visible = true;

    Subject1durationHr_txt.text = '0 '.

    Subject1durationMin_txt.text = "00";

    Subject1durationSec_txt.text = "00";

    Subject1timeLeftHr_txt._visible = true;

    Subject1timeLeftMin_txt._visible = true;

    Subject1timeLeftSec_txt._visible = true;

    Subject1pause_btn._visible = false;

    Subject1start_btn._visible = true;

    Subject1rotor_mc._visible = false;

    Subject1rotor_mc.gotoAndStop (1);

    delete Subject1timer_mc.onEnterFrame;

    delete Subject1durationLeft;

    delete Subject1duration;

    delete Subject1durationHr_txt.text;

    delete Subject1durationMin_txt.text;

    delete Subject1durationSec_txt.text;

    };

    I think you need to spend time by reducing your code at a practical level.  You seem to be any passage in the book in each function and I think that probably none of this is necessary.  If you have declared these variables at the beginning, then you don't need to transfer them to any function, because they are gobally available to one of the functions/code that follows.  Similarly, if you have some textfields on stage, it is pointless to pass those in all functions for the same reason.

    I see you doing the overuse of 'delete' (and possibly errant use as well).  Is probably the only thing you might want or need to use...

    delete Subjectxtimer_mc.onEnterFrame;

    Which stops the enterframe trigger activity, which I think is used to update the textfields which indicate the time.

    And that conditional uses == Nan is not likely to do anything except wonder what is a Nan.  TextFields hold the strings, which are cited.  SO unless you have a variable named Nan somewhere that has a value of string assigned to her, this condition will do nothing for you.  You probably don't need it at all if you get this working properly.

  • which calls the function?

    I have a clip of a square in the library exported as a Square1, I place 2 instances of it on stage and push them into an array called ar
    I add ar event listeners [0] and ar [1] to do a certain function.
    I need flash to tell me that ar [0] or ar [1] called the function. How do I do that?
    Thank you!

    Manno is right-

    also great - the loop that you have built it will build not just two 3 instances. However if you are wanting to "store" the index of the item in this instance-specific table, you need to create a property on the instance itself and then reference this prop - as in:

    Add to the loop
    This ['place' + i] .index = i;

    in the use of the Manager
    Event.Target.index

  • How can I get a value from a function from pl/sql by OADBTransaction

    Hi all
    Hope you will be fine.
    as we know, we can get a sequence by this code value:
    Super.Create (AttributeList);
    Transaction OADBTransaction = getOADBTransaction();

    Vendor ID is obtained from the table sequence
    Number supplierId = transaction.getSequenceValue ("FWK_TBX_SUPPLIERS_S");

    My question is how can I get a value in a variable to a pl/sql function:
    the function is defined as follows:
    ******
    create or replace function getNextTrans return varchar2
    is
    Team varchar2 (20);
    Start
    SELECT "CASH". TO_CHAR (SYSDATE, 'DDMMYYYY') | GP_CASH_TRX_SEQ. NEXTVAL FROM DUAL;
    return team;
    end;
    /

    Hey Dina,

    Reference http://www.oraclearea51.com/oracle-technical-articles/oa-framework/229-calling-database-procedures-and-function-from-oaf.html

    Kind regards
    GYAN

  • Possible to have the function to return the Flex Code (ie: &amp; lt; mx:Text text = &amp; quot;) Hello World &amp; quot; / &amp; gt ;)?

    I'm new to Flex and need extraordinary case some features using XML... not all items come with images so I thought that the best way to handle this was to pass each flow element to a function which can be used if the statements and then return back to the user interface code:

    For example printFeed() would return something like the following if there was an image:

    < mx:Text text="{XML.channel.currentItem.title}"/ >
    < mx:Image source="{XML.channel.currentItem.img.url}"/ >

    OR the following, if it doesn't have an image:
    < mx:Text text="{XML.channel.currentItem.title}"/ >

    Is this the right approach? Also, what is the right way to invoke printFeed? {printFeed ("..."))} Spear analysis errors.

    Thank you!

    -Cole

    Thank you, Amy! Your answer was not quite the solution, he informed me of the visible and includeInLayout options... I created a function that tests whether the length is > 0 and returns true/false that is introduced into the visible and includeInLayout

  • on the web all sites from the top of the page 3 or 4 lines which contain the control tabs do not work

    the top 3 or 4 lines on all websites that contain, click options do nothing when I click on them. the hand that is supposed to happen
    When the cursor is on the option does not work.

    Sounds familiar, but I don't remember the cause. I think that that is the by-product of an add-on. Can you think of any that you installed recently? You can see the extensions (most likely culprit) here:

    Orange Firefox button or classic menu Tools > Modules > category: Extensions

    Probably more effective to just disable everything that is non-essential, reboot and see if that makes a difference.

Maybe you are looking for