How to display the values of sno using the query?

Hi all
I use oracle 10g. Could u pls help for sno or count as follows.below is the set of sample data,
100 JOE 1-JAN-2012 1000
100 JOE 15-FEB-2012 3000
200 MAX 1-MAR-2012 5000
200 MAX 1-APR-2012 5000
200 MAX 1-MAY-2012 4000
.... ..... ............... ......
I need the o/p should be displayed with the County as follows.
sno eno name   hdate          amt
1  100   JOE   1-JAN-2012    1000
2  100   JOE   15-FEB-2012   3000
1  200   MAX   1-MAR-2012   5000
2  200   MAX   1-APR-2012   5000
3  200   MAX   1-MAY-2012   4000
.. .... ..... ............... ......
How to reach this sno 1,2,3 for each record? is it possible?. can u suggest me the solution?

Thank you

Concerning
Vids

Hi vidusnat,

SQL> with t as (
  2  select 100 eno, 'JOE' name, to_date('1-JAN-2012', 'DD-MON-YYYY') hdate, 1000 amt from dual
  3  union all
  4  select 100 eno, 'JOE' name, to_date('15-FEB-2012', 'DD-MON-YYYY') hdate, 3000 amt from dual
  5  union all
  6  select 200 eno, 'MAX' name, to_date('1-MAR-2012', 'DD-MON-YYYY') hdate, 5000 amt from dual
  7  union all
  8  select 200 eno, 'MAX' name, to_date('15-APR-2012', 'DD-MON-YYYY') hdate, 5000 amt from dual
  9  union all
 10  select 200 eno, 'MAX' name, to_date('15-MAY-2012', 'DD-MON-YYYY') hdate, 4000 amt from dual
 11  )
 12  select row_number() over (partition by t.eno order by t.hdate),t.* from t
 13  ;

SQL> /

ROW_NUMBER()OVER(PARTITIONBYT.ENOORDERBYT.HDATE)        ENO NAM HDATE            AMT
------------------------------------------------ ---------- --- --------- ----------
                                               1        100 JOE 01-JAN-12       1000
                                               2        100 JOE 15-FEB-12       3000
                                               1        200 MAX 01-MAR-12       5000
                                               2        200 MAX 15-APR-12       5000
                                               3        200 MAX 15-MAY-12       4000

SQL>

Kind regards
Gennady

Tags: Database

Similar Questions

  • How to display the value of the variable for bottom of pl/sql

    How to display the value of the variable for bottom of pl/sql

    declare

    V_1 number: = 10;

    V_2 number: = 20;

    V_3 number: = 30;

    v_4 number: = 40;

    v_5 number: = 50;

    test varchar2 (100);

    Start

    I'm in 1.5

    loop

    test: = "v_" | I have;

    dbms_output.put_line(i||) e > ' | test);

    end loop;

    end;

    /

    How to get below output:

    1 > v_1

    2 > v_2

    3 > v_3

    4 > v_4

    5 > v_5

    But I want to output of

    1 > 10

    2 > 20

    3 > 30

    4 > 40

    5 > 50

    Hello

    You cannot reference variables as you did and get the value of the variable. Use pretty collection.

    set serveroutput on size 2000
    declare
      type      number_table is table of number;
      numbers   number_table := number_table(10, 20, 30, 40, 50);
    begin
      for i in numbers.first .. numbers.last
      loop
        dbms_output.put_line(i || '->' || numbers(i));
      end loop;
    end;
    /
    
    anonymous block completed
    1->10
    2->20
    3->30
    4->40
    5->50
    

    See the Collections of PL/SQL and Records http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/composites.htm#LNPLS005

  • How to display Quick values in the story

    With the help of 11.1.1.6.2

    In a dashboard page, I have a table with a hierarchy of dimension for the organization. If you click on a division he runs a link action to call a script in the browser (javascript in a text on the dashboard section) from the division. If you expand the section, and then click on a market, it calls the function javascript even.

    Then, the Javascript function uses path go to update an analysis in an iFrame on the dashboard page and passes the value of the Division or the market value.

    The analysis of the target has two filters: Division is invited and the market is invited.

    So, after all, my question is how could display two values from the call of the road go into a narrative on the analysis of the target? Or I guess the other question is how to view the filter on the narrative values.

    Sorry for the long explanation, but I hope it makes sense.

    Thanks for any help or suggestion.

    Brad

    Try something using the Div tag
    for ex:
    < div id = filterValues > @{WeekBetween} {Default Value} < / div >
    < script >
    var i = document.getElementById('filterValues').innerHTML;
    document.getElementById('filterValues').innerHTML = aParams ["varDivision"];
    < /script >

    If brand pls help

  • How to display the values of this query? The type is XDB. XDB$ STRING_LIST_T

    Hi all

    If I run this query using a tool like developer PL/SQL (SQL window), the values are displayed as a Collection. Just click and see the results of the al.

    Select
    dbms_resconfig.getRepositoryResConfigPaths)
    Of
    Double;


    I want to know how to display these values using any tool of sqlplus (with dbms_output or something like that).

    How can I do? With the help of the table? Create a type?

    TKS

    user12083350 wrote:

    I want to know how to display these values using any tool of sqlplus (with dbms_output or something like that).

    SQL> select * from table(dbms_resconfig.getRepositoryResConfigPaths())
      2  /
    
    COLUMN_VALUE
    --------------------------------------------------------------------------------
    /sys/xs/userrc.xml
    /sys/xs/rolesetrc.xml
    /sys/xs/drolerc.xml
    /sys/xs/rolerc.xml
    /sys/xs/frolerc.xml
    /sys/xs/xdserc.xml
    /sys/xs/scrc.xml
    
    7 rows selected.
    
    SQL> 
    

    And in PL/SQL:

    SQL> declare
      2      v_list xdb$string_list_t := dbms_resconfig.getRepositoryResConfigPaths();
      3  begin
      4      for i in 1..v_list.count loop
      5        dbms_output.put_line(v_list(i));
      6      end loop;
      7  end;
      8  /
    /sys/xs/userrc.xml
    /sys/xs/rolesetrc.xml
    /sys/xs/drolerc.xml
    /sys/xs/rolerc.xml
    /sys/xs/frolerc.xml
    /sys/xs/xdserc.xml
    /sys/xs/scrc.xml
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    SY.

    Published by: Solomon Yakobson, April 24, 2010 15:04

  • How to display the drop-down list box in MS excel by using labview report generation toolkit? pleasepost code block diagram?

    How to display the drop-down list box in MS excel by using labview report generation toolkit? Please post the block diagram of the code so that I can able to generate from the drop-down list box in excel with the menu drop-down...

    Like this. (edition, use the reference forms instead of the reference to the worksheet)

    Ben64

  • How to display the list of temporary and free sites that we use?

    Adobe Web Host - Free Sites.

    How to display the list of temporary and free sites that we use?

    When you're connected creative cloud, we used to be able to view the temporary and lots of 5 free sites that we use hoe.

    Could not find a list on my creative cloud account or when the link to 'Manage' in the Muse.

    No mention of the free sites in the FAQ. Is there a change in policy? Are always included in the subscription of the free sites?

    - Adobe Muse help | Adobe Muse / Common Questions .

    When I publish in Adobe Muse CC, must I pay for hosting with Adobe?

    Adobe Muse CC allows you to publish your Web site temporary on the platform Adobe of accommodation free of charge for a trial period of 30 days. This gives you the ability to send a direct URL to your client for review. All sites with Adobe trial mode will include the field "businesscatalyst.com" in it. If you decide to take the live site by paying for monthly hosting, you can transfer your domain name and delete the subdomain businesscatalyst.com. Or you can export the HTML and host the final site with a host of your choice.

    //

    Yes, don't know why they took out of the cloud interface.

    But if you go to http://www.businesscatalyst.com/partnerportal and you connect with your ID cloud you will have access to all your cloud sites and many other features.

  • How to display the results in the order based on the value of research

    Hi all

    How to display the results in the slot order.
     
    
    CREATE TABLE TEST( SONGID  NUMBER, TITLE   VARCHAR2(200))
    
    INSERT INTO TEST(SONGID,TITLE) VALUES (10,'AHMADZAI, MIRWAIS (CA)/ MADONNA (CA)');
    INSERT INTO TEST(SONGID,TITLE) VALUES (11,'CICCONE, MADONNA (CA)');
    INSERT INTO TEST(SONGID,TITLE) VALUES (12,'DALLIN, MADONNA LOUISE/STOCK');
    INSERT INTO TEST(SONGID,TITLE) VALUES (13,'MADONNA');
    INSERT INTO TEST(SONGID,TITLE) VALUES (14,'MADONNA (A)/ AHMADZAI, MIRWAIS (C)');
    INSERT INTO TEST(SONGID,TITLE) VALUES (15,'MADONNA (CA)');
    INSERT INTO TEST(SONGID,TITLE) VALUES (16,'MIRWAIS AHMADZAI, MADONNA');     
    INSERT INTO TEST(SONGID,TITLE) VALUES (17,'MIRWAIS (CA)/ MADONNA (CA),AHMADZAI');
    INSERT INTO TEST(SONGID,TITLE) VALUES (18,'MADONNA (CA),CICCONE');
    
    SELECT *FROM  TEST WHERE INSTR (TITLE, 'MADONNA') > 0
    
    output: 
    SONGID     TITLE
    10     AHMADZAI, MIRWAIS (CA)/ MADONNA (CA)
    11     CICCONE, MADONNA (CA)
    12     DALLIN, MADONNA LOUISE/STOCK
    13     MADONNA
    14     MADONNA (A)/ AHMADZAI, MIRWAIS (C)
    15     MADONNA (CA)
    16     MIRWAIS AHMADZAI, MADONNA
    17     MIRWAIS (CA)/ MADONNA (CA),AHMADZAI
    18     MADONNA (CA),CICCONE
    
    Expected output :
    13     MADONNA
    14     MADONNA (A)/ AHMADZAI, MIRWAIS (C)
    15     MADONNA (CA)
    18     MADONNA (CA),CICCONE
    ..
    ..
    ..
    ..
    ...
    If the user makes a search with "MADONNA", I view the results as title begins with "MADONNA" first then the rest of the records.
    Please let me know is possible to show the results in this order.


    Kind regards
    Rajasekhar

    This can be a little more specific:

    SQL> SELECT *
      2  FROM   TEST
      3  WHERE  INSTR (TITLE, 'MADONNA') > 0
      4  ORDER  BY INSTR (TITLE, 'MADONNA')
      5           ,TITLE
      6  ;
    
                  SONGID TITLE
    -------------------- --------------------------------------
                      13 MADONNA
                      14 MADONNA (A)/ AHMADZAI, MIRWAIS (C)
                      15 MADONNA (CA)
                      18 MADONNA (CA),CICCONE
                      12 DALLIN, MADONNA LOUISE/STOCK
                      11 CICCONE, MADONNA (CA)
                      17 MIRWAIS (CA)/ MADONNA (CA),AHMADZAI
                      16 MIRWAIS AHMADZAI, MADONNA
                      10 AHMADZAI, MIRWAIS (CA)/ MADONNA (CA)
    
  • How to display the java console on Windows 7 using Sun Java plug-in

    Hi all

    I have an Oracle 11 g installation Rel2 developer on my windows machine.

    For the purposes of debugging, I would like to know / Access how to display the java console.

    Thanks in advance...!

    You turn on the Java Console in the applet of the control panel Java (Start Menu-> Control Panel-> Java-> tab advanced-> Java Console).

    Craig...

  • SQL: how to display the second string of the function in the Jobs table only if the function has more than one string.

    SQL: how to display the second string of the function in the Jobs table only if the function has more than one string.

    Hello

    You can use REGEXP_SUBSTR Oracle/PLSQL: REGEXP_SUBSTR function

    Select the function double REGEXP_SUBSTR('PUBLIC RELATION REPRESENTATIVE ','[^]+',1,2);

    Do you have any value of the column as no 2nd string?

  • How to display the data items in the header of tempalte

    Hello friends
    I have this date_from and date date_to parameters which are parameters that the user enters...
    based on these parameters of date, I want to display in the header as
    date_from day (for example if the date_from is 13 - nov - 2010.then I should see 13) and date_to to display as 15, if for example the user enters
    November 16, 2010. (day of the date-1)
    so it should break down for
    date_from-13-nov-2010, 13
    date_to-16-nov-2010, 15
    I want these two values to display in the header of the template how
    pls help
    also let me know how to display the data items in the header template

    Published by: Les on Dec 22, 2010 12:44 AM

    Use and

  • How to display the width of the page or the big screen in firefox 11 automatically?

    How to display the width of the page or the big screen in firefox 11 automatically? I know how to Ctrl +, ctrl - and ctrl 0, but is there a way to define 11 firefox to automatically set the page viewing by default "page width" or full screen (F11 not)?
    Help, please. Thank you.

    You can use an extension to set a page zoom and the size of the default font on the web pages.

  • How to display the name of my refnum on the front?

    I write data to a file. To do this, I use ' Open/create/replace the file' to prompt the user for a file name, which is then out of my VI as a refnum. I then write strings in this file with "write to a text file.

    How to display the name of the file (including the path) on the front panel once the user has entered it?

    Michael

    Use the Refnum at the path of e/s from file-> advanced file palette. You can wire it to a path indicator.

  • How to display the lsit of play while visualizations are playing

    How to display the playlist while visualizations are playing

    What version of WMP are you using?

    You can usually right click the button reading at the top and select view the list pane.

  • How to display the menu bar in Windows Explorer?

    I use Intel Core i5-3470 CPU @ 3.20 GHz, 8, 0 GB of RAM, Intel HD graphics card
    MS Windows 7 Home Premium v. 6.1 64-bit SP1
    I have Kaspersky Internet Security in 2014, and I Google Talk, Skype and Memeo Backup Premium Pro running in the background.

    I tried to display the path in Windows Explorer (see arrow)

    None of these options allows to get anything.

    How to display the path?

    1. Click on start, then run
    2. Type: REGSVR32 /i BROWSEUI. DLL
    3. Close all Windows Explorer Windows
    4. Bring up the Task Manager
    5. Kill explorer.exe (which is the operation of the office)
    6. In Task Manager, select file, then new task (run)
    7. Type explorer.exe

    Open a new Windows Explorer, the address bar should now be visible.

  • How to display the language bar in Windows 8?

    How to display the language bar in Windows 8? I have three input languages installed. When I right click on the taskbar, click Toolbars, the language bar does not appear as an option.

    How to display the language bar in Windows 8? I have three input languages installed. When I right click on the taskbar, click Toolbars, the language bar does not appear as an option.

    Hello

    On how to Activate the language in the taskbar . Click here Link 1 or link 2 
    I hope this helps.
    Rafa. M -please click the 'Mark as answer' or 'Useful' button at the top of this message.   Marking a post as answer, or relatively useful, you help others find the answer faster
  • BI Layout Editor - how to display the current date?

    Hello

    Recently used BI Layout Editor (previously using MS Word to create the presentation of the State).

    He seems really nice and easy to use.

    However quick Q - How to display the current date in the layout editor (to show the report run date).

    Any quick suggestions is appreciated.

    Thank you

    Vivek

    Tab displays your selection available.

    It's like how when you insert the table in the Word document and when you select the table, you would see 2 additional tabs such as the design and the tool.

    Can you please insert "Text Element" and select the text element and see if you go to the tab 'text '?

Maybe you are looking for