Remove duplicates by selecting the first line of each subgroup in a Recordset

Oracle: 11 GR 2

Client Windows 7

I have a set of data (the result of a query) which is similar to:

D_rank product_id product_desc category income price cost

1 112233 prod1-iphone phone 200 500 100

1 112233 prod1-iphone4 phone 200 500 100

2 223344 prod2-300 1000 400 windows7 OS

2 223344 prod2-300 1000 400 software windows7

3 334455 prod3-Mac 1000 computer 1500-1000

4 445566 prod4-xyz 2000 800 1200 misc

:                    :               :                                   :               :             :              :

:                    :               :                                   :               :             :              :

:                    :               :                                   :               :             :              :

As you can see the first 4 rows, these rows are repeated due to the product_desc and category material. I need these fields but the first value in each subgroup, so that each row is unique. I.e.

D_rank product_id product_desc category income price cost

1 112233 prod1-iphone phone 200 500 100

2 223344 prod2-300 1000 400 windows7 OS

3 334455 prod3-Mac 1000 computer 1500-1000

4 445566 prod4-xyz 2000 800 1200 misc

:                    :               :                                   :               :             :              :

:                    :               :                                   :               :             :              :

:                    :               :                                   :               :             :              :

You will enjoy the little help.

Hello

user13667036 wrote:

Oracle: 11 GR 2

Client Windows 7

I have a set of data (the result of a query) which is similar to:

D_rank product_id product_desc category income price cost

1 112233 prod1-iphone phone 200 500 100

1 112233 prod1-iphone4 phone 200 500 100

2 223344 prod2-300 1000 400 windows7 OS

2 223344 prod2-300 1000 400 software windows7

3 334455 prod3-Mac 1000 computer 1500-1000

4 445566 prod4-xyz 2000 800 1200 misc

:                    :               :                                   :               :             :              :

:                    :               :                                   :               :             :              :

:                    :               :                                   :               :             :              :

As you can see the first 4 rows, these rows are repeated due to the product_desc and category material. I have need of these fields but the first value of each subgroup...

...

What does "first" here?  What "subgroup"?

Depending on your needs, maybe you want to Request Top - N, something like this:

WITH got_r_num AS

(

SELECT d_rank, product_id, product_desc, category, price, income, cost

ROW_NUMBER () OVER (PARTITION BY d_rank

ORDER BY product_desc, category

) AS r_num

OF data_set

)

SELECT d_rank, product_id, product_desc, category, price, income, cost

OF got_r_num

WHERE r_num = 1

;

I hope that answers your question.

If this isn't the case, please post a small example of data (CREATE TABLE and INSERT statements) and the results desired from these data.  (I know you said this is a game of results from a query, and not an array, but the solution is the same as the entry is a single table, or a query, perhaps involvoing several tables.)

Report when the request above is erroneous results and explain, using specific examples, how find you the correct results from these data.

As said ground, see the FAQ in the forum: Re: 2. How can I ask a question on the forums?

Tags: Database

Similar Questions

  • make the first line of each paragraph "BOLD"

    Hi all

    I read this forum, but I can't really find the answer, I need.

    Here's my problem, we intend to automate the flow of text in our Organization, that's what I have to do

    -read the input from the story of a database

    -flow text into a text box in particular for example 4.5 cm wide

    -each paragraph will be had 2 new lines

    -Select the first line of each paragraph then putting in bold.

    in the above list, I can do everything except the first paragraph selection and putting in bold. I am looking for the selection of text I see there is a function called textframe.select?

    Can someone help me with this please?

    This severely reduced your options. (Which reminds me, you can specify a detail important like that from the beginning the next time.)

    The simple solution would be to apply your "BOLD" font (or better: a character style) in the first line of each paragraph by using the property of a paragraph .lines. UH customary ‑‑ link to the HTML version of the omitted OMV, it seems I'm not coming back as much as CS2... (Is there a CHM for it to http://www.jongware.com/idjshelp.html).

    This should work:

    App.Selection [0] .paragraphs [0]. Lines [0] .appliedCharacterStyle = "YourBoldCharStyle";

    ... With your cursor in the paragraph you want to change. Will adjust to meet your specific needs.

    There is a drawback of the simple method. Unless you use a special police who makes bold with the same width as her (quite rare) usually, the text will be redistributed after he applied. So there are one or more words in bold on the next line, so you must remove the tank style "BOLD" of those. But! At that time InDesign may determine that these non-bold words may go back on the first line!

    Well written code does not help, because it could be possible the same word oscillates backwards with each change between the first and the second line, each time to cheat... At * some * point you'll have to help the poor ID a bit; perhaps to fix this first line with No Break applied.

  • Select the first line of the annotations in a vm

    Hello

    I want to extract only the first line of the note annotations of a vm.

    I tried WAT

    $vm = get - vm host1

    $vm.description | Select - 1 first

    But I continue to receive the full description, which looks like this

    Microsoft exchange server

    support: 24 x 7

    OTAP: Production

    Status: In Production

    Try something like this

    $vm = get-vm windows1$vm.description -split '["\n\r"|"\r\n"|\n|\r]' | select -First 1
    
  • When I select the first line number I get a little gray box pop up. This looks like a changer of glyph. How to disable this option?

    Screen Shot 2016-01-06 at 10.39.30 AM copy.png

    Above is the example. I don't know what happened (my fault or updated) to activate it, but I can't find anything to delete it. It's not useful because it does not work for numbers later in the line, only the first issue.

    You can disable this option in advanced Type preferences, the bottom section.

  • Delete in af:table always remove the first line when using ExecuteWithParams

    Hello world

    I got a page with master form and af:table two details related to the master. When I'm trying to remove a line in an af:table of detail, it always removes the first line, any line, I selected before. The table has a single = rowSelection and the line is properly visually selected. I remove the line using a "delete hyperlink" on each line, but I first have to select the line. Delete called a bond (or a method at the bean by removing the current line of the iterator, I tried both, none of them work)

    Links page has an ExecuteWithParams defining the correct ID to edit on the master of iterator and an InvokeExecuteWithParams the renderModel value. If I put the refresh condition zero and I hard-code an ID in the binding variable in the model, I am able to delete the selected line.

    In addition, I don't know if this information is useful, but if I set the iterator to PPR ChangeEventPolicy, when I select a line, there always select the first line.

    Any ideas what I could do wrong? Is this a bug?

    I use JDev 11.1.1.7

    Thank you

    Guillaume

    You can try creating a method in ApplicationModule for filter master records instead of executeWithParams?

    Ashish

  • Pulling on the first line with a value of repetition

    Hello
    We use the Oracle 11.1.

    We have a table of postal codes.

    We have several lines for each zip code because we have different areas that use the same zip code.

    We want to reduce the lines of a line by zip code. But they said use they want to keep the fields that differ (neighborhood of the exodus).

    Then they said "Just take the first value of each."

    This code reduces the postcodes of a line by postal code, but as you can see I replaced the field with the name of the field values.
    SELECT distinct  ZIPCODE, CITY, STATE, COUNTY, AREACODE, 'CITYTYPE', CITYALIASABBREVIATION, 'CITYALIASNAME', LATITUDE, LONGITUDE, TIMEZONE, ELEVATION, COUNTYFIPS, DAYLIGHTSAVING, PREFERREDLASTLINEKEY, CLASSIFICATIONCODE,
               MULTICOUNTY, STATEFIPS, 'CITYSTATEKEY', 'CITYALIASCODE', 'PRIMARYRECORD', CITYMIXEDCASE, 'CITYALIASMIXEDCASE', STATEANSI, COUNTYANSI
        FROM   zip_code
    GROUP BY   ZIPCODE, CITY, STATE, COUNTY, AREACODE, CITYTYPE, CITYALIASABBREVIATION, LATITUDE, LONGITUDE, TIMEZONE, ELEVATION, COUNTYFIPS, DAYLIGHTSAVING, PREFERREDLASTLINEKEY, CLASSIFICATIONCODE, MULTICOUNTY, STATEFIPS,
               CITYALIASCODE, PRIMARYRECORD, CITYMIXEDCASE, STATEANSI, COUNTYANSI
    order by zipcode; 
    How should I take either one record per postal code with the first value in these fields or

    How should I take the first record for each zip code?

    either way works for me.

    Thank you

    Hello

    This is called a Query Top - N , and this is a way to do it:

    WITH     got_r_num     AS
    (
         SELECT     z.*
         ,     ROW_NUMBER () OVER ( PARTITION BY  zipcode
                                   ORDER BY          city
                             ,                ...   -- add tie-breakers here
                           )      AS r_num
         FROM    zip_code
    )
    SELECT     *     -- or list all columns except r_num
    FROM     got_r_num
    WHERE     r_num     = 1
    ;
    

    You can simply use MIN or MAX on the columns, as the line with the name of the minimum city do not lowest have area code or the longitude. The above method preserves the first line of each zip code intact, where the 'first': the first in order of aphabetic by the name of the city. If it is not unique, then you may want breakage to the analytical ORDER BY clause.

    If you are deleting rows, you can use this in a NOT IN subquery. If you copy lines to a new table, you can use the query above in an INSERT statement.

    Published by: Frank Kulash, March 18, 2011 12:40

    I just see Polywog response:

    Pollywog wrote:
    You can use the rank or rownumber function...

    If I understand the problem, you don't want to use RANK in this particular case. When there is equality, GRADE will assign 1 to all the contenders. I think the whole point of this thread is that you exactly want a #1 in each zip code, which is what ROW_NUMBER, but not RANK, guarantees.

  • How can I get the first line of a paragraph style indent, but others not in withdrawal

    I created a style of paragraph indented on the first line of each paragraph. In most of the books, at the start of the first line of a chapter, this line is not indented while the rest are. Is there a way to set up in InDesign CS3? Is the only way to make this work is to manually go out the tab at the start of each chapter?

    2 paragraph styles.

    1 paragraph style has no dash

    2nd paragraph style has dash

    set "next style" in 1st paragraph for paragraph 2e style style

    the "next style" value in the style of paragraph 2 to "even".

    Existing text.

    Select all of the text

    Right-click on the 1 paragraph style and select apply style then next style.

    New text (typeing)

    Start typing with the selected 1 paragraph style. When you press ENTER to start a new paragraph, the style will switch automatically to the 2nd paragraph style to what manually enable you return.

    HTH

    -mt

  • Problem with white - style commentary on the first line of the select statement.

    SQL * more error? :
    It seems that the parser does not like "-" at the end of the first line of the request.
    I see this error "ORA-00936: lack of expression" or "ORA-00933: not correctly completed SQL command.
    SQL * Plus costs number not the 2nd line when I do that.
    If a space follows-, '-', I still get the error.
    a single "-" at the end of the line is ignored and the query works
    But, "-." will not get the error.
    I think that I had this problem before on the inside in the middle of a procedure from PL/SQL package.
    --
    It is of course easy to avoid. Is this just a quirk or am I missing something?
    -----
    SQL * more: 9.0.1.4.0 output
    Oracle Database 10 g Enterprise Edition release 10.2.0.3.0

    ----------------------------------------------
    -- These provoke an error
    ----------------------------------------------
    SQL select 'a' --
     from dual;
    select 'a' - from dual
                 *
    ERROR at line 1:
    ORA-00936: missing expression
    
    /* the -- is "-- " */
    SQL select 'a','b','c' --
     from dual;
    select 'a','b','c' - from dual
                         *
    ERROR at line 1:
    ORA-00936: missing expression
    
    SQL select --
     select 'a' from dual --
     ;
    select - select 'a' from dual -
             *
    ERROR at line 1:
    ORA-00936: missing expression
    
    
    SQL select 'a' from dual --
     ;
    select 'a' from dual -
                         *
    ERROR at line 1:
    ORA-00933: SQL command not properly ended
    ----------------------------------------------
    -- These are OK 
    ----------------------------------------------
    SQL select 'a' --.
      2  from dual;
    
    '
    -
    a
    Elapsed: 00:00:00.00
    SQL select
      2  'a' --
      3  from dual;
    
    '
    -
    a
    
    ------- a single "-" at the end of the line is ignored, query works
    SQL select 'a' from dual -
     ;
    
    '
    -
    a
    
    
    SQL

    Actually, it's in the docs, but we rarely know.

    >
    Continuing a long SQL More control on additional lines *.
    You can continue a long SQL * more command by typing a hyphen at the end of the line and press return. If you want, you can type a space before you type the hyphen. SQL * Plus displays a right angle (>) support as a prompt for each additional line (not in iSQL * more).

    For example:

    SALARY $99 999 COLUMN FORMAT-
    SECTION "WAGES."
    Since SQL * Plus identifies the hyphen as a continuation character, entering a hyphen in a statement SQL is ignored by SQL * more. SQL * more does not identify the declaration as a SQL statement until after the treatment of entry has joined lines together and removed the hyphen. For example, enter the following:

    SELECT - 200
    100 DOUBLE;
    Returns the error:

    >

    It only happens for the first line of a sql statement, because at that time there you are not in the edit buffer. And the order could still be a sql * more order and not a sql command.

    Published by: Sven w. on August 7, 2009 16:51

  • How to select and default hightlight the first line in a programmatic Table(ADF Table created based on a SortableModel) ADF.

    Hi all


    We use JDeveloper Studio Edition Version 12.1.3.0.0 and deployed on GlassFish Server Open Source Edition 3.1.2.2 (build 5) and connect to the SQLServer database.


    We created a table ADF programming related to a SortableModel created programmatically to a bean.


    We need to select and highlight the first row in the table just after making it to retrieve data based on the first line.


    We tried the based on the following thread: How to call the bean support just after JSFF / page fragment loads? and a few other posts online, but it does not work very well.


    W has created a hidden text in the bottom of the JSF model as follows:


    < af:table varStatus = "rowStat" Summary = "table" value = "#{pageFlowScope.crudBean.dynamicTable.collectionModel} '"

    Rows = "#{pageFlowScope.crudBean.dynamicTable.collectionModel.RowCount} '"

    contentDelivery = 'immediate' var = 'row' rendered = 'true '.

    Binding = "#{backingBeanScope.crudBackingBean.tasksTable} '"

    selectionListener = "#{backingBeanScope.crudBackingBean.customListener} '"

    "rowSelection ="single"id ="t1"partialTriggers =": pt_gr2 "columnStretching =" column: clmn0 ">

    < af:forEach items = "#{pageFlowScope.crudBean.dynamicTable.columnNames}" var = 'name' varStatus 'vs' = > "

    < af:column sortable = "true" sortProperty rowHeader = "#{name}" = "no style" headerText = "#{pageFlowScope.crudBean.dynamicTable.columnLabel [name]}" "

    inlineStyle = "width: 100px;"  ID = "clmn$ {vs.index}" >

    < af:activeOutputText value = "#{row [name]}" id = "aot1" / >

    < / af:column >

    < / af:forEach >

    < / af:table >

    ....


    < af:outputText id = "hiddenOutputTextId" visible = "false" value = "#{backingBeanScope.crudBackingBean.afterPageLoad} '"

    Binding="#{backingBeanScope.crudBackingBean.hiddenOutputText}"/ >

    And we have added the code to the bean to support below:

    public String getAfterPageLoad() {}

    If (!.) {AdfFacesContext.getCurrentInstance () .isPostback ()}

    selectFirstRowInTasksTable();

    }

    Return afterPageLoad;

    }

    public void selectFirstRowInTasksTable() {}

    try {}

    RKS RowKeySet = new RowKeySetImpl();

    RowKeySet rksEmpty = new RowKeySetImpl();

    Model CollectionModel = tasksTable.getValue ((CollectionModel));

    ROWCOUNT int = model.getRowCount ();

    If (rowcount > 0) {}

    model.setRowIndex (0);

    Key of the object = model.getRowKey ();

    RKS. Add (Key);

    tasksTable.setSelectedRowKeys (rks);

    SelectionEvent selectEvent =

    new SelectionEvent (tasksTable.getSelectedRowKeys (), rks, tasksTable);

    selectEvent.queue ();

    customListener (selectEvent); / / to retrieve data

    AdfFacesContext.getCurrentInstance () .addPartialTarget (tasksTable);

    }

    } catch (Exception e) {}

    }

    }

    I think that () selectEvent.queue; should work even without calling the customerListener, but it is not working in all cases.

    What is the problem in my code?



    Have you tried to bind property of 'selectedRowKeys' to selection configuration / bean there?

    Something like:

    public RowKeySet getSelectedRKS() {
        if (rks == null) {
            // make first record as selected
            // create RowKeySet and assign it to rks variable(where rks is variable defined in bean with some scope higher than request scope)
        }
        return rks;
    }
    

    Dario

  • Remove the first line xml generated xml to VO

    I am combining multiple xml files to generate the report using BIPublisher. I generated xml based on a VO by using VO.writeXML. How can I remove first row (<? xml version = "1.0"? >) in the xml file?

    Use the transformer and setOutputProperty to omit the first line.

    Transformer transformer = TransformerFactory.newInstance () .newTransformer ();
    transformer.setOutputProperty (OutputKeys.OMIT_XML_DECLARATION, 'yes');

    Edited by: Puthanampatti Dec. 6 2012 18:42

  • Get only the first line of duplicate data

    Hello

    I have the following situation...
    I have a table called employees with column (object, name, function) where "re" is the primary key.

    I import data within this table using an xml file, the problem is that some employees may be repeated inside this xml file, which means, I'll have repeated "re", and presents the columns is a primary key of my table.

    To work around this problem, I created a table called employees_tmp that has the same built as employees, but without the primary key constraint, on this way I can import the XML inside the employees_tmp table.

    What I need now is to copy that data employees_tmp used, but for cases where the "re" is taken, I just want to copy the first line found.

    Just an example:

    EMPLOYEES_TMP
    ---------------------
    RE FUNCTION NAME
    ANALYST GABRIEL 0987
    MANAGER GABRIEL 0987
    RANIERI ANALYST 0978
    VICE PRESIDENT RICHARD 0875


    I want to copy the data to employees looks like

    EMPLOYEES
    ---------------------
    RE FUNCTION NAME
    ANALYST GABRIEL 0987
    RANIERI ANALYST 0978
    VICE PRESIDENT RICHARD 0875

    How would I do that?

    I really appreciate any help.

    Thank you

    Try,

    SELECT re, NAME, FUNCTION
      FROM (SELECT re,
                   NAME,
                   FUNCTION,
                   ROW_NUMBER () OVER (PARTITION BY re ORDER BY NAME) rn
              FROM employees_tmp)
     WHERE rn = 1
    

    G.

  • How do to "BOLD" in the first line of text on a number of sections of text at a time

    CS5 using (but we have CS5

    .5 available) we will create a business directory. Each page has columns of type

    business listings with the company name on top, under this address under this phone, etc.  Each ad is separated

    by a single line. There are thousands of ads, and we need to "BOLD" in the top line of each. How can do us

    without making them individually?

    Each line a paragraph, or each list a paragraph with soft returns (forced line breaks)?

    It's very simple and basic in both cases an operation. It is especially easy if each ad has the same number of lines, so we will focus first with this case.

    Each line should be a separate paragraph. If you have 4 lines, as your example, you might want to mention their name, street, city, and phone. You can and should, all the styles that will be similar in appearance on the same basic model and change only the atrributes that are different, so, for example, if all lines use the same font, many use the same size and weight and only the top line is different and only by being "BOLD" and or larger size start by defining the street, then city and phone based Street and you don't need to define something more than the next Style, I'll get to in a second.

    For topics, set name based as well on the street, but change the font characters. Now all the features of the basic fonts can be changed in one place, the definition of the style Stree.

    Since you have the same number of lines in each list, you can set up a loop "next style". For name, style next street is, the street is the city, for the city it is the phone and is name for the phone. You will also need to toe after the add space in the name, or space on the phone to book spaces registration and you probably also consider to assign everything except phone keep with the next line to prevent a list from breaking across a page or column break. If currently you have blank lines as separators (empty paragraphs), get rid of them. There are change queries find already registered in ID that will do that.

    Once the text is in place and the styles are defined, you can select all, then right click on the style name in the paragraph Styles Panel and choose apply following Style and name. Reformatted your entire list. IT IS CRITICAL in this method that the structure of each list is identical, and if there are no empty lines between the lists.

    If each line is a paragraph, but there is line different counts, you will probably reach with just two styles, one for the headings oand one for everything else, but the beat of following style will not work. If there is something unique that appears in all the headings you can use find/replace to make search and reformat in shape, but I suspect that this will not be the case on in the real world, there will be a manual work involved.

    Where a lisitn is a single paragraph, line break forced (which is better suited to the case of an uneven lines by registration number) you can define a character style nested to be applied by means of a line break forced to make the first line "BOLD", red or any other thing you want.

    At this point, you are probbly, noting that a bit before planningn is a good idea when you do a directory so that your ads have some sort of coherent structure that allows for automation. I have no idea whre that your text is coming from or how it is done in the code. If it can be established as a .csv or a tab-delimited text file, you can use data merge to fill a file based on a model of merge (i.e., how to build directories for my clients who need). You can set styles in the model to each field or paragraph that contains several fields, and merge data will remove empty lines if all row fields are null and there is no punctuation or whitespace on the line.

    A multiple records per page fusion will give you individual blocks of text for each record, and you can, if you wish, thread them using the script text point of Rorohiko.com.

  • the first line is empty

    Hi all

    I'm on the underside of queries and the first line is empty. What I'm missing here. Can someone help me how I can remove this empty (I suppose as null) line. Thank you
    SELECT DISTINCT (DECODE (subclass_type,
                             'Utility_Agreement', 'Utility Agreement',
                             'Master_U_Agreement', 'Master Utility Agreement',
                             'Utility_Wo_Agreement', 'Work Order'
                            )
                    ) ntext,
                    (DECODE (subclass_type,
                             'Utility_Agreement', 'Utility Agreement',
                             'Master_U_Agreement', 'Master Utility Agreement',
                             'Utility_Wo_Agreement', 'Work Order'
                            )
                    ) nval
               FROM wh_agreement
    SELECT DISTINCT (DECODE (subclass_type,
                             'Utility_Agreement', 'Utility Agreement',
                             'Master_U_Agreement', 'Master Utility Agreement',
                             'Utility_Wo_Agreement', 'Work Order'
                            )
                    ) ntext,
                    (DECODE (subclass_type,
                             'Utility_Agreement', 'Utility Agreement',
                             'Master_U_Agreement', 'Master Utility Agreement',
                             'Utility_Wo_Agreement', 'Work Order'
                            )
                    ) nval
               FROM wh_agreement
              WHERE subclass_type IN('Utility_Agreement', 'Master_U_Agreement', 'Utility_Wo_Agreement')
    
  • I can only access buttons of menu on the first line when I use mode full-screen, why?

    Many Web sites I visit have on the first line of the web page in a series of menu options that do not respond when I move the mouse to select options. If I use the mode full screen these buttons work correctly. These buttons work correctly when I use IE or Chrome. I am running Windows 7 and this has happened in the last two weeks.

    Recently, the extension of the Yahoo! toolbar and the extension of Babylon have been reported to cause a problem like that. Disable or uninstall the modules.

       * https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
    
  • Select the first or last row of sql Command

    Hello

    I am trying to get the fist or the last line of output from sql below

    SQL> set head off;
    SQL> select  r.actual_start_date,r.phase_code,r.status_code,r.actual_completion_date from
      2      apps.fnd_concurrent_programs_vl p, apps.fnd_concurrent_requests r
       where p.concurrent_program_id = r.concurrent_program_id
      3    4      and p.application_id = r.program_application_id
      5      and p.user_concurrent_program_name like 'Purge Concurrent Request and/or Manager Data'
      6  and  r.actual_start_date >= sysdate-7
    --and rownum<1
      7    8  --order by r.requested_start_date
      9  ORDER BY r.actual_completion_date DESC;
    
    
    29-DEC-13          C C 29-DEC-13
    28-DEC-13          C C 28-DEC-13
    27-DEC-13          C C 27-DEC-13
    26-DEC-13          C C 26-DEC-13
    25-DEC-13          C C 25-DEC-13
    24-DEC-13          C C 24-DEC-13
    23-DEC-13          C C 23-DEC-13
    
    
    7 rows selected.
    
    
    SQL> select  r.actual_start_date,r.phase_code,r.status_code,r.actual_completion_date from
      2      apps.fnd_concurrent_programs_vl p, apps.fnd_concurrent_requests r
       where p.concurrent_program_id = r.concurrent_program_id
      3    4      and p.application_id = r.program_application_id
      5      and p.user_concurrent_program_name like 'Purge Concurrent Request and/or Manager Data'
      6  and  r.actual_start_date >= sysdate-7
      7  and rownum<2
      8  --order by r.requested_start_date
      9  ORDER BY r.actual_completion_date DESC;
    
    
    
    27-DEC-13          C C 27-DEC-13
    
    
    
    
    
    
    SQL> select  r.actual_start_date,r.phase_code,r.status_code,r.actual_completion_date from
      2      apps.fnd_concurrent_programs_vl p, apps.fnd_concurrent_requests r
       where p.concurrent_program_id = r.concurrent_program_id
      3    4      and p.application_id = r.program_application_id
      5      and p.user_concurrent_program_name like 'Purge Concurrent Request and/or Manager Data'
      6  and  r.actual_start_date >= sysdate-7
      7  and rownum<1
      8  --order by r.requested_start_date
      9  ORDER BY r.actual_completion_date DESC;
    
    
    no rows selected
    
    
    SQL>
    
    

    I want to get the last run of the program which is the first line of the top of the output of sql. (which is December 29, 13, first row on top of the exit)

    But if I use the condition as ' where rownum < 1, its not giving any output, if I use where rownum < 2, if you do not have out. "

    Grateful if someone can help.

    -Thank you

    Vijay...

    Hi Vijay,

    The following should work...

    ROWNUM< 1="" will="" not="" retrieve="" any="" rows="" as="" rownum="" values="" start="" with="" 1.="" to="" get="" the="" desired="" result="" you="" have="" to="" build="" the="" result="" set,="" order="" it="" and="" then="" select="" the="" desired="">

    SELECT *.

    Of

    (SELECT r.actual_start_date,

    r.phase_code,

    r.status_code,

    r.actual_completion_date

    Apps.fnd_concurrent_programs_vl p,

    Apps.FND_CONCURRENT_REQUESTS r

    WHERE p.concurrent_program_id = r.concurrent_program_id

    AND p.application_id = r.program_application_id

    AND p.user_concurrent_program_name LIKE 'Serve concurrent demand and/or Manager Data'

    AND r.actual_start_date > = sysdate-7

    -Order of r.requested_start_date

    ORDER BY r.actual_completion_date DESC

    )

    WHERE rownum< 2="">

    I hope this helps.

    VR,

    Sudhakar

Maybe you are looking for

  • iPhoto import is not .mov files

    iPhoto is important is no longer files .mov from my iPhone to my iMac. I use OS x 10.9.5 and iPhoto 9.5.1. All .mov files are turned on my iPhone 6s either as Live Photos or movies. It used to work fine before, don't know why it stops suddenly. Thank

  • Camileo H20 - new firmware

    Hi, in my view must issue new firmware, which addresses the following issues:* - Files AVI unsupported-> avi is invalid *.* - Date and time display will not turn on *.* - There is no difference between PAL and NTSC settings (still 30 fps) *.* - Setti

  • How to remove easy shopper

    easy shopper ads keeps popping up on my browser.  is it possible to remove it please?

  • HP 110 min: pls, am havin problem abt to remove the current password hp 110 min

    Helloam having problem remove current password in hp 110 min

  • ITunes game problem

    I recently added music from a CD on my itunes. The music is on my Imac, but not my iPhone or Ipad? One of the sons said Apple Support there library > Update iCloud music library from the menu at the top of your computer screen bar! I don't see this o