sequential numbers without using order by or partition of

Hello
My version of db: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production

I write a query like this:
SELECT location, value
FROM params ep
    ,t2
WHERE ep.model = 'M1'
    AND ep.etype = t2.etype   
ORDER BY t2.orderid, ep.location

output:
location    value
loc51    val51
loc52    val52
loc53    val53
loc54    val54
loc55    val55
loc56    val56
loc57    val57
loc58    val58
loc59    val59
I want to change the sql, to get output like this
location    value rank
loc51    val51  1
loc52    val52  2
loc53    val53  3
loc54    val54  4
loc55    val55  5
loc56    val56  6
loc57    val57  7
loc58    val58  8
loc59    val59  9
I see that if I used the analytical functions like row_number, rank etc, I must give an order by clause.
But my requirement is, independently of any column, I want to be numbered sequentially.

More like, get the exit first and then he number sequentially.

Please advice.

Published by: 934451 on June 4, 2013 10:45

I just want to get the output of a sql and then he number sequentially.

That's what rownum: http://www.orafaq.com/wiki/ROWNUM

Do you mean that you use ORDER BY, but you have to number the lines after the order?

SELECT location, value, ROWNUM
FROM
( SELECT location, value
  FROM params ep
      ,t2
  WHERE ep.model = 'M1'
    AND ep.etype = t2.etype
  ORDER BY t2.orderid, ep.location )

Published by: Rangel Marcus on June 4, 2013 15:02

Tags: Database

Similar Questions

  • 6 random numbers without repetition

    I'm doing a generator of 6 random numbers between 1 and 48. When the user clicks a button randomly 6 numbers appear in 6 different textFeilds. The problem is that I don't want the same number twice. How can I generate 6 different random numbers without using back and out of the service?

    import flash.events.Event;

    Stop();

    btn.addEventListener (MouseEvent.CLICK, random1);

    function random1 {(evt:Event)}

    display1. Text = "";

    Display2.text = "";

    Display3.text = "";

    display4. Text = "";

    display5. Text = "";

    display6. Text = "";

    var r1 = Math.floor (Math.random () *(1+48-1)) + 1;

    var r2 = Math.floor (Math.random () *(1+48-1)) + 1;

    var A3 = Math.floor (Math.random () *(1+48-1)) + 1;

    var r4 = Math.floor (Math.random () *(1+48-1)) + 1;

    var A5 = Math.floor (Math.random () *(1+48-1)) + 1;

    var A6 = Math.floor (Math.random () *(1+48-1)) + 1;

    If (r2 = r1 | r3 == r2 | r4 == r3 | r5 == r4 | r6 = r5) {}

    return;

    }

    var list: Array = new Array();

    Liste.push (R1, R2, R3, R4, R5, R6);

    Liste.sort (Array.Numeric);

    display1. Text = String (list [0]);

    Display2.Text = String (list [1]);

    Display3.Text = String (list [2]);

    display4. Text = String (list [3]);

    display5. Text = String (list [4]);

    display6. Text = String (list [5]);

    }

    Here is the code for the approach mentioned with your included textfields

    btn.addEventListener (MouseEvent.CLICK, random1);

    function random1 {(evt:Event)}

    var nums:Array = new Array();

    Complete the table of numbers

    for (var i: uint = 1; i<=48;>
    Nums.push (i);
    }

    Shuffle (NUMS);

    Take the first six of the mixed table

    var list: Array = nums.splice (0.6);

    assign values to the textfields

    for (var j: uint = 1; j<=6;>
    This ["Display" + String (j)] .text = String (list [j]);
    }
    }

    function shuffle(a:Array) {}
    var p:int;
    var t: *;
    var ivar:int;
    for (ivar =. Length-1; Ivar > = 0; Ivar-) {}
    p = Math.Floor ((Ivar+1) * Math.Random ());
    t = a [ivar];
    a [ivar] = a [p];
    a [p] = t;
    }
    }

  • find the second value of the largset without using the command by

    Hello world

    can tell me, if we can find the second maximum value for a column without using
    order by clause.

    Bye and thanks.

    Hello

    Please see this.

    SQL > select * from emp where sal<(select max(sal)="" from="">

    EMPNO, ENAME, JOB HIREDATE DEPTNO COMM SAL MGR
    ---------- ---------- --------- ---------- --------- ---------- ---------- ----------
    7369 SMITH COMMITTED 7902 17 DECEMBER 20 800 80
    7499 ALLEN 7698 1600 20 FEBRUARY SALESMAN 81 300 30
    7521 WARD 7698 1250 22 FEBRUARY SALESMAN 81 500 30
    7566 JONES MANAGER 7839 2975 2 APRIL 81 20
    7654 MARTIN 7698 28 - SEP - 81 1250 1400 30 SALESMAN
    7698 BLAKE MANAGER 7839 2850 MAY 1, 81 30
    7782 CLARK MANAGER 7839 2450 JUNE 9 81 10
    7788 SCOTT ANALYST 7566 3000 APRIL 19, 87 20
    7844 TURNER 7698 08 - SEP - 81 1500 0 30 SALESMAN
    7876 ADAMS 7788 1100 23 MAY CLERK 87 20
    7900 7698 DECEMBER 3, CLERK JAMES 81 950 30

    EMPNO, ENAME, JOB HIREDATE DEPTNO COMM SAL MGR
    ---------- ---------- --------- ---------- --------- ---------- ---------- ----------
    7902 7566 3000 3 DECEMBER ANALYST FORD 81 20
    7934 MILLER COMMITTED JANUARY 7782 1300 23 82 10
    1-1-10

    14 selected lines.

    SQL > select max (sal) from emp where sal<(select max(sal)="" from="">

    MAX (SAL)
    ----------
    3000

    Concerning

  • Order Import - profile of sequential numbering

    I'm working on the importation of the order, according to customer's requirement that they would like the same order number, as they were inherited. We put the "Sequential numbering" profile option to "Not used" at the level of the site.

    When I submit the import order program he ends with the message below.

    Message from the source/line/command/Seq
    13234/34567 / / your profile option does not autodial.
    Please ask your system administrator to change the sequential
    Profile of numbering.

    Can someone help me on this.

    Thank you!

    (1) set the profile at the application level AND level of responsibility.
    (2) make sure that your user to the profile level value is empty or properly mounted.

    Sandeep Gandhi

  • How to install xp on a partition using cprompt, without using a floppy disk in windows 7

    I want to install windows XP in one partition of my hard drive and I tried to install using windows XP CD whenever I get to the installation of windows environment a blue screen will come telling me that windows has stopped to prevent the HDD to harm. And I tried all the solutions, I got online not it solved the problem. So, I want to perform the installation to the windows command prompt 7 without using floppy disks, all that I need on your part are the steps on how to perform the installation, thank you

    The most convenient way to install Windows XP on a computer that is running Windows 7 currently is to download and install the free Windows XP Mode.  However, you must run Windows 7 Professional or ultimate edition to install.  If you happen to be running Windows 7 Home Edition, you can purchase and install a Windows Anytime Upgrade: Windows 7 Home Premium to professional.

  • by selecting each of the nth order key without using a rank value

    Hello

    Suppose we have a table of Orders

    create table orders)

    order_no number primary key,

    customer_id number,

    item_id number);

    insert into orders)

    Select 101, 601, 90 of all the double union

    Select 103, 602, 100 of all the double union

    Select 603, 105, 110 Union double all the

    Select 107, 604, 120 Union double all the

    Select double union all 108, 605, 130

    Select double union all 109, 606, 140

    Select 110, 607, 150 Union double all the

    Select 111, 608, 160 Union double all the

    Select 112, 609, 170 Union double all the

    Select 114, 610, 180 doubles);

    How can we take every third order_no controlled key order_no without use of rank and connect function using sql.

    as

    105,

    109,

    112

    can someone please help?

    Thank you

    Max

    How can we choose each third order_no order_no keys without the use of grade -controlled

    Reason is?

    Anyway, using ROWNUM then:

    SQL > select order_no

    2 starting at)

    3. Select order_no, rownum rn

    4 of)

    5. Select order_no

    6 orders

    7 order of order_no

    8    )

    9)

    10 where mod (rn, 3) = 0;

    ORDER_NO

    ----------

    105

    109

    112

  • I need to disable my Creative Suite license on another computer in order to activate it on a new computer, but the old computer crashed and I can't use it. Is it possible to disable the other computer without using this computer?

    I need to disable my Creative Suite license on another computer in order to activate it on a new computer, but the old computer crashed and I can't use it. Is it possible to deactivate the license on the old computer without using it?

    you are allowed two facilities, activations, you should may not disable before activating on your new computer.

    But if you don't, contact adobe for hourly pst support by clicking here and, when available, click on "still need help," https://helpx.adobe.com/contact.html.  Ask a county of activation reset.

  • I exported the photos in a folder that is named in the order. Now I want to export more photos in the same folder, but take the sequential numbers where the last export was stopped. Finally was Apr_409, in following should be Apr_410. Not Apr_1 (1). Any a

    I exported the photos in a folder with the photos sequentially named. Now I want to export more photos in the same folder, but take the sequential numbers where the last export was stopped. So if the last photo was named Apr_409, I want the following to be Apr_410. Not Apr_1 (1). Any advice? Thank you!

    Hat is not a feature of Photos.

    If you want to make sure your new export is sorted after previous export, change the field "sequential prefix" in the Panel of the export to a string, which will be sorted after the original prefix you have chosen.

  • Limit of 2 TB on 2nd HARD drive, how to change without affecting the system reserved Partition?

    I have 2 drives - 240GB SSD where Windows is installed and a HD in Toshiba 3 TB of data.

    After installing Windows 7 for the SSD, it creates a system reserved 100 MB Toshiba hard disk partition. I now want to create a single data (d) on the Toshiba partition but disk management only limit myself to create a partition of 2 TB and a 746 GB partition. Past posts to dig suggests it's the MBR problem - then what can I do now to break this limit, without deleting or play with the 100MB system reserved partition?

    Hi YT :)

    You're right, that this problem is caused by the fact that your hard drive is cut using the style of partition table MBR, which allows only to create partitions to a maximum of 2 TB size each. In order to 'break' this limit, you must convert your hard drive in a GPT partition table, which does not have this limit (well, the limit to 128 TB then there it doesn't matter much). You can convert your hard disk from MBR to GPT without loss of data. Follow the instructions in the tutorial below:

    http://www.thewindowsclub.com/convert-MBR-to-GPT-disk

    Method 2 and 3 explain how to perform the conversion without loss of data, method 3 is the easiest.

    Let me know if you have any questions.

    Yoan

  • help in the application without using the pivot function

    Hi gurus,

    Can you please help write the query without using the PIVOT function.
     WITH indata AS
             (SELECT 1 sn, '123:456,789,323:456,213,344,345:5454' x
                from dual
              UNION ALL
              SELECT 2, 'abcd:fgrfr,rfrf,rfred,tg:tg,tg:ophhh,op,vdfgbh:poijn' x from dual),
            instr AS
             (SELECT a.SN,
                     rownum RN,
                     B.column_value || CASE
                       WHEN B.column_value NOT LIKE '%:%' THEN
                        ':'
                     END column_value 
                FROM indata a,
                     TABLE(CAST(multiset
                                (SELECT trim(SUBSTR(x,
                                                    (CASE LEVEL
                                                      WHEN 1 THEN
                                                       1
                                                      ELSE
                                                       instr(x, ',', 1, LEVEL - 1) + 1
                                                    END),
                                                    (CASE instr(x, ',', 1, LEVEL)
                                                      WHEN 0 then
                                                       4000
                                                      ELSE
                                                       instr(x, ',', 1, LEVEL) - 1 -
                                                       (CASE LEVEL
                                                          WHEN 1 THEN
                                                           0
                                                          ELSE
                                                           instr(x,
                                                                 ',',
                                                                 1,
                                                                 level - 1)
                                                        END)
                                                    END)))
                                   FROM dual
                                 CONNECT BY level <=
                                            LENGTH(x) -
                                            LENGTH(REPLACE(x, ',', '')) + 1) AS
                                sys.odcivarchar2list)) b)
            SELECT  col1_val2,
                    col1_val1,
                    col2_val2,
                    col2_val1,              
                   systimestamp
              FROM (select SN,
                          ROW_NUMBER() over(partition by SN order by RN) RN,
                           SUBSTR(column_value, INSTR(column_value, ':') + 1) VAL1,
                           substr(column_value, 1, instr(column_value, ':') - 1) val2
                      FROM instr ) PIVOT(MAX(VAL1) VAL1, MAX(VAL2) VAL2 FOR SN IN(1 as col1,2 as col2));
    Thanks in advance!...

    Any help would be appreciated.

    user590978 wrote:

    Can you please help write the query without using the PIVOT function.

    with indata as (
                    select 1 sn,'123:456,789,323:456,213,344,345:5454' x from dual union all
                    select 2, 'abcd:fgrfr,rfrf,rfred,tg:tg,tg:ophhh,op,vdfgbh:poijn' x from dual
                   ),
             t1 as (
                    select  x
                      from  indata
                      where sn = 1
                   ),
             t2 as (
                    select  x
                      from  indata
                      where sn = 2
                   ),
             t3 as (
                    select  level lvl,
                            substr(
                                   x,
                                   instr(',' || x,',',1,level),
                                   instr(x || ',',',',1,level) - instr(',' || x,',',1,level)
                                  ) col1
                      from  t1
                      connect by level <= length(x) - length(translate(x,'A,','A')) + 1
                   ),
             t4 as (
                    select  level lvl,
                            substr(
                                   x,
                                   instr(',' || x,',',1,level),
                                   instr(x || ',',',',1,level) - instr(',' || x,',',1,level)
                                  ) col2
                      from  t2
                      connect by level <= length(x) - length(translate(x,'A,','A')) + 1
                   ),
             t5 as (
                    select  lvl,
                            substr(col1,1,instr(col1 || ':',':') - 1) col1_val1,
                            substr(col1,instr(col1 || ':',':') + 1) col1_val2
                      from  t3
                   ),
             t6 as (
                    select  lvl,
                            substr(col2,1,instr(col2 || ':',':') - 1) col2_val1,
                            substr(col2,instr(col2 || ':',':') + 1) col2_val2
                      from  t4
                   )
    select  col1_val1,
            col1_val2,
            col2_val1,
            col2_val2,
            systimestamp
      from      t5
            full join
                t6
            on (
                t6.lvl = t5.lvl
               )
      order by coalesce(t5.lvl,t6.lvl)
    /
    
    COL1_VAL1  COL1_VAL2  COL2_VAL1  COL2_VAL2  SYSTIMESTAMP
    ---------- ---------- ---------- ---------- -------------------------------------
    123        456        abcd       fgrfr      23-OCT-12 11.50.12.015000 AM -04:00
    789                   rfrf                  23-OCT-12 11.50.12.015000 AM -04:00
    323        456        rfred                 23-OCT-12 11.50.12.015000 AM -04:00
    213                   tg         tg         23-OCT-12 11.50.12.015000 AM -04:00
    344                   tg         ophhh      23-OCT-12 11.50.12.015000 AM -04:00
    345        5454       op                    23-OCT-12 11.50.12.015000 AM -04:00
                          vdfgbh     poijn      23-OCT-12 11.50.12.015000 AM -04:00
    
    7 rows selected.
    
    SQL> 
    

    SY.

  • I want the single update query without using the function.

    I want to update sells_table selling_code field with product_code date product table max.
    In the product table, there are several product_code date wise.

    I did with below charly with the use of the service, but we can do in the query what a single update
    without using the function.

    UPDATE sells_table
    SET selling_code = MAXDATEPRODUCT (ctd_vpk_product_code)
    WHERE NVL(update_product_flag,0) = 0;

    (P_product IN VARCHAR2) RETURN of HVL.maxdateproduct NUMBER FUNCTION to CREATE or REPLACE
    IS
    max_date_product VARCHAR2 (100);
    BEGIN
    BEGIN
    SELECT NVL (TRIM (product_code), 0)
    IN max_date_product
    FROM (SELECT product_code, xref_end_dt)
    PRODUCT
    WHERE TO_NUMBER (p_product) = pr.item_id
    ORDER BY xref_end_dt DESC)
    WHERE ROWNUM = 1; -He'll be back a single line - max date product code
    EXCEPTION
    WHILE OTHERS
    THEN
    RETURN 0;
    END;

    RETURN max_date_product;

    END maxdateproduct;

    Thanks in advance.

    Hello

    Something like that.

    update setlls_table st
            set selling_code =(select nvl(trim(product_code)) from
                                  (select product_code
                                          , rank() over (partition by item_id order by xref_end_dt DESC) rn
                                       from product
                                   ) pr
                                   where rn =1
                                         and pr.item_id = st.ctd_vpk_product_code
                               ) where NVL(update_product_flag,0) = 0 ;
    

    That such is not tested due to lack of sampling input.

    Concerning
    Anurag Tibrewal.

  • a way to talk to the command prompt without using exec.vi system

    I had used exec.vi system in recent weeks to send commands to the command prompt and then bring back the exit in labview. All of a sudden this week the vi does not work and I can not even an exec.vi system output when I send the same commands that I sent before. I was wondering if there was another way to send & receive orders from the cmd prompt in labview without using exec system?


  • Any way to reinstall windows without using external software?

    Sometimes I use programs that are too big for my computer.  They are usually dialog boxes.  And dialog boxes usually have the final orders down.  Which I don't see.  I drag the window to the top, but it is still too long and I can't move it all further because the title bar is completely out of the screen at the top.  I'm holding it by a single line one pixel.  With the help of the tool move does nothing: it must always click/drag on the title bar.  Is anyway to move in a coordinated way, without using external software such as Sizer?  Sorry, I've had the suspect using substantive programmes and it really wouldn't help me, because I do not see the handle which allows access to the size options.

    To move the Windows Active when you can't reach the title bar with the mouse cursor, press and release of + , and press .  You can now use the cursor arrows to move the window back to the desired location.  When the box is located here where you want, press .

  • How to record what is happening by the sound card without using the microphone to avoid loss of quality.

    I tried, but there is no "Stereo mix" available options. There is only the (Conexant High Definition Audio) Microphone. It did not work. What I'll do is to buy a DVD for TV (tv Record program) burner and plug the hdmi cable from my computer to the DVD recorder and record what I want. After that, I just rip the audio from the file. I see no other option to do. I use windows vista Home premium.

    I would like to know how I can record the sound that is played by the soundcard using Vista without using the microphone as a source. Let's say the audio is played (audio stream) and I want to record this stream. There are many software that we can download that record what is happening in the microphone. The sound bounces off the speakers to the microphone. But when this happens, you lose a lot of the quality of the audio. So my question is if it is possible to record what is happening to the right of the sound card, before being sent to the sound card in order to avoid the loss of audio quality.

    ==============================
    Movie Maker has an option to record Narration...
    (Tools / tell the chronology). If you select stereo mix
    as the "Audio Input Source", you can save the
    Audio online. Your speakers and microphone are
    not required.

    And... maybe this link will help:

    How to record Internet radio stations on Windows Vista (using Audacity)
    http://www.ehow.com/how_4604071_record-Internet-radio-Windows-Vista.html John Inzer - MS - MVP - digital media experience

  • Why can't I access the internet without using safe mode

    Help cannot access internet without using safe mode

    Hi Dharrington25,
     
    -Remember to make changes to your computer after that this problem started to happen?
     
    As you are able to access the Internet using the safe, put your computer in a clean boot state in order to identify the program causing this problem.
     

    Put your boot system helps determine if third-party applications or startup items are causing the problem. If so, you need to maybe contact the manufacturer of the program for updates or uninstall and reinstall the program.

    See KB Microsoft article below for more information on how to solve a problem by performing a clean boot in Windows Vista or in Windows 7:How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

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

    Note: After troubleshooting, be sure to set the computer to start as usual as mentioned in step 7 in the above article.

Maybe you are looking for

  • The dual SSID Signal interference

    I have the cable and Internet provided by AT & T.  I mainly had Comcast when you live in different parts of the country.  I am owner of an Airport Extreme and Time Capsule I used previously to set up the network internal in addition to the SSID broad

  • Scanner not recognized

    FET scanner my printer Laserjet M1217nfw MFP, connected to an iMac/OS 10.11.3, has always worked well. Now, it is no longer recognized by the computer, even though I downloaded an updated driver.

  • How to read data from the memory on the computer that was written by another program host

    Hi all This is my first post. I am very new to LabView and I just finished 1 Core and Core 2 with no experience of LabView. I have a card SilconSoftware acquisition with an FPGA card on it to capture and image of a CamerLink sensor processing. The FP

  • Possible bug in Media Player

    Last Sunday, I sent the following letter to * address email is removed from privacy: * - - - - - - Hello secure, I wrote a simple program to produce. WAV files. It seems to workWell, but it has a strange problem. If the file contains a number of samp

  • Windows Installer and 641 & 80070641 Error Codes problems

    something happened to the installer of windows on my computer. I have vista home premium 32 bit. I tried to search your site to download the installer, but I found nothing. I tried to install Java and he said: he just couldn't because windows install