How to display maximum (most recent) date value in a query

hello,
I have the following query:
StudentNumber | ExternalOrganization | Date |         | NumbeOfAdmissions
0112                  050                            06/27/2007   1
0234                  060                            07/15/2008   1
1356                  025                            01/08/2008   1
My dilemma is how to display only the row that has the most recent Date, e.g. here I want to only see the row with student number 0234 and date 07/15/2008; everything else should be hidden.
I know it should be very simple....yes/no?
thanks

Hi
even I am facing the same problem..
Can you please tell me what did you do to get most recent record..
Even I have made my date field as KF.. n have put condition on it.. but not getting desired result.. may be I am missing something.. somewhere..
I resolved it.. thanks
Regards
Swati
Edited by: Swati on Feb 17, 2009 7:49 AM

Similar Messages

  • How to select the most recent date in a CR XI subreport

    Post Author: rickcf
    CA Forum: General
    I have a sub report and it is simply a reporting of a sub table.  It is a table that has multiple records with many dates coupled with types.  I only want the most current date for certain types - the types can have more than one date.  Much like the following select statement
    select type, max(date) from table where type <> 'E' group by type.
    How can I accomplish this in crystal? 
    Thanks

    Post Author: Jagan
    CA Forum: General
    Group on type. Use record selection formula for type <> E, use group selection formula for the max date. e.g. group formula is{table.date} = maximum({table.date, table.type})

  • ALV Report how to display from and to date values in the header.

    I develoeped alv report . i want to display selection screen from and to date values in  top of page...
    any sample code pls guide me..

    You have to do many things...
    first find the selection details using the FM.
    RS_REFRESH_FROM_SELECTOPTIONS
    use the Blog to Align/populate the Header  from the selection table
    /people/community.user/blog/2007/05/07/alignment-of-data-in-top-of-page-in-alv-grid

  • How to display last 10 minutes data  only using sql query

    Hi,
    Presently, I'm using version is,
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE 11.1.0.6.0 Production
    TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    So, please consider SCOTT Schema to resolve my issue,
    I want to display only last 10 minutes what records are inserted or updated or deleted.
    Please provide in many ways!!
    ThankQ!!

    Hi,
    See below:
    select
    from
      emp
    EMPNO ENAME      JOB        MGR HIREDATE      SAL    COMM DEPTNO
    7369 SMITH      CLERK     7902 17-DEC-80     800             20
    7499 ALLEN      SALESMAN  7698 20-FEB-81    1600     300     30
    7521 WARD       SALESMAN  7698 22-FEB-81    1250     500     30
    7566 JONES      MANAGER   7839 02-APR-81    2975             20
    7654 MARTIN     SALESMAN  7698 28-SEP-81    1250    1400     30
    7698 BLAKE      MANAGER   7839 01-MAY-81    2850             30
    7782 CLARK      MANAGER   7839 09-JUN-81    2450             10
    7788 SCOTT      ANALYST   7566 19-APR-87    3000             20
    7839 KING       PRESIDENT      17-NOV-81    5000             10
    7844 TURNER     SALESMAN  7698 08-SEP-81    1500       0     30
    7876 ADAMS      CLERK     7788 23-MAY-87    1100             20
    7900 JAMES      CLERK     7698 03-DEC-81     950             30
    7902 FORD       ANALYST   7566 03-DEC-81    3000             20
    7934 MILLER     CLERK     7782 23-JAN-82    1300             10
    14 rows selected
    select
    from
      emp
    minus
    select
    from
      emp
       as of timestamp (systimestamp - interval '10' minute)
    EMPNO ENAME      JOB        MGR HIREDATE      SAL    COMM DEPTNO
    0 rows selected
    update
      emp
    set
      ename = ename || ' x'
    where
      empno = 7934
    --1 rows updated.
    select
    from
      emp
    minus
    select
    from
      emp
       as of timestamp (systimestamp - interval '10' minute)
    EMPNO ENAME      JOB        MGR HIREDATE      SAL    COMM DEPTNO
    7934 MILLER x   CLERK     7782 23-JAN-82    1300             10
    */For changes, deletes and inserts compair the two result (emp and emp as of timestamp (systimestamp - interval '10' minute) ) with each other.
    Regards,
    Peter

  • Most recent date query..

    Hi All..
    I have 2 tables note and sub_note and sample data is..
    create table note(note_date date,pmry_id number,sub_id number not null)
    insert into note(note_date,pmry_id,sub_id) values('12/30/2008 02:12:52',282,1)
    insert into note(note_date,pmry_id,sub_id) values('12/23/2008 10:12:24',282,1)
    insert into note(note_date,pmry_id,sub_id) values('12/22/2008 01:12:11',282,1)
    insert into note(note_date,pmry_id,sub_id) values('12/22/2008 09:12:56',282,1)
    insert into note(note_date,pmry_id,sub_id) values('12/19/2008 01:12:54',282,1)
    insert into note(note_date,pmry_id,sub_id) values('12/22/2008 09:12:56',282,2)
    insert into note(note_date,pmry_id,sub_id) values('12/22/2008 09:12:57',282,2)
    create table sub_note(sub_id number not null,sub_name varchar2(100))
    insert into sub_note(sub_id,sub_name) values(1,'Product')
    insert into sub_note(sub_id,sub_name) values(2,'Expectations')how can select the most recent date for product and most recent date for expectations...joining these 2 tables..
    Thanks in advance...

    user10280715 wrote:
    Thanks for the reply...
    that was only a sample data..so I kept 2 sub_names for a perticular pmry_id..my original data contains several sub_names(about 5) for a perticular pmry_id...
    hope you gt my point..I'm not sure I understand.
    If you have 5 sub_names that you're interested in, change the WHERE clause to have those 5 sub_names. The list after "IN" can have as few as 1 or as many as 1000 items. (I'm not too sure about the upper limit, and it may be version-dependent.)
    If you want to include all sub_names, then omit the WHERE clause.

  • How do I get the numbers ipad app to plot a graph of dates against values, where the most recent date is on the right of the graph, but the most recent date is at the top rather than bottom of the rows in the table?

    How do I get the numbers ipad app to plot a graph of dates against values, where the most recent date is on the right of the graph, but the most recent date is at the top rather than bottom of the rows in the table?
    Also how can it be a line graph without plotting a circle at each value?
    Thanks this is very frustrating

    Make a copy of the table and produce your Line chart or Bar chart from the copy. Sort the copy into the order you want to see in your chart.
    Alternately you could use a Scatter Chart...
    Jerry

  • How to display record with most recent date in sapui5?

    Hi
    I have a local json data with me, in which I have number of records.
    And in each record I have an "AENDATE" as a date property.
    Now I want to display the record with most recent date in the records.
    How I can I do it......????????
    Please help me with this.
    Thanks
    Sathish

    How about sorting your json model descending, and display only first (index:0) item?

  • How to determine most recent date from the date column of internal table

    Dear friends
    would you like to tell me. how i determine the most recently changed record by looking at date and time from internal table i am not supposed to sort the table by date and time... I must check date and time with other records date and time to determine which record is most recently changed...
    here the scenario is.
    id idnumber chdate chtime
    1 123456 20060606 135312
    2 123456 20060606 135900
    3 123456 20060606 132300
    4 123457 20060606 140000
    5 123457 20060606 142500
    in the above scenario i must keep in my mind that the most recently changed record is identical to its idnumber i can say that:
    the record should be fetched this way
    id idnumber chdate chtime
    3 123456 20060606 132300
    5 123457 20060606 142500
    because here the id 3 is the most recently changed in the idnumber 123456
    where id 5 is the most recently changed in the idnumber 123457
    please help me to determin how i am supposed to carry out this task any suggestion, code will be great help of mine.
    regards
    Naim

    After testing my suggestion above, I realized that it doesn't work because the delete adjacent actually will keep the first one and delete the rest.  I'm working with Srinivas's code a bit now,  I think it is almost what you want.  I am under the impression that you dont' want to HIGHest date/time, but just the last record of the sequence, if this is the case, then this code will help.  Here we will assign an index to each record per the idnumber, that way we can sort it and get the lastest record.
    report zrich_0001.
    types: begin of itab_type,
            id       type i,
            idnumber type i,
            chdate   like sy-datum,
            chtime   like sy-uzeit.
    types: end of itab_type.
    types: begin of itab_type2,
            id       type i,
            idnumber type i,
            index    type i,
            chdate   like sy-datum,
            chtime   like sy-uzeit.
    types: end of itab_type2.
    data: itab     type table of itab_type with header line,
          itab2    type table of itab_type2 with header line,
          prev_rec type itab_type.
    data: v_id type i.
    start-of-selection.
      itab-id       = 1.
      itab-idnumber = 123456.
      itab-chdate   = '20060606'.
      itab-chtime   = '135312'.
      append itab. clear itab.
      itab-id       = 2.
      itab-idnumber = 123456.
      itab-chdate   = '20060606'.
      itab-chtime   = '135900'.
      append itab. clear itab.
      itab-id       = 3.
      itab-idnumber = 123456.
      itab-chdate   = '20060606'.
      itab-chtime   = '142500'.
      append itab. clear itab.
      itab-id       = 4.
      itab-idnumber = 123457.
      itab-chdate   = '20060606'.
      itab-chtime   = '140000'.
      append itab. clear itab.
      itab-id       = 5.
      itab-idnumber = 123457.
      itab-chdate   = '20060606'.
      itab-chtime   = '120000'.
      append itab.
      clear itab.
    <b>  data: counter type i.
    * Assign an index to each row per idnumber
      loop at itab.
        on change of itab-idnumber.
        if sy-tabix > 1.
          clear counter.
          endif.
        endon.
        clear itab2.
        move-corresponding itab to itab2.
        counter = counter + 1.
        itab2-index = counter.
        append itab2.
      endloop.
    * Sort it and get rid of older records.
      sort itab2  by idnumber ascending
                     index descending.
      delete adjacent duplicates from itab2 comparing idnumber.</b>
      read table itab2 with key idnumber = '123456'.
      write:/ itab2-chdate, itab2-chtime.
      read table itab2 with key idnumber = '123457'.
      write:/ itab2-chdate, itab2-chtime.
    Regards,
    Rich Heilman

  • Most recent date (UDATE) from CDHDR table based on CDPOS

    Hi,
    I am working on one object where i stuck with one issue. The requirement is I have to retrieve the most recent date from CDHDR table based on CHANGENR in CDPOS table. Where i am doing FOR ALL ENTRIES on CDPOS table to get the MAX( date )and i got the error, that aggregate functions are not allowed except COUNT( * ) with for all entries.
    Any thread which can solve this issue would help aswel.
    Please guide me how to achieve this. <removed>
    Edited by: Thomas Zloch on Mar 13, 2010 9:10 PM

    Hi Li,
    Thats was really helpful information , infact my requirement is same as what you said. I even checked in the table entries there is only one changenumber.
    You said we can take the first record, i even did the same. But for TABNAME I have to pass 3 table name 'LFA1', 'LFB1' and 'LFM1'. For FNAME 'LOEVM', 'SPERR'. I have written the code as below.
      SELECT objectclas
                   objectid
                   changenr
                   FROM cdpos
                   INTO TABLE i_cdpos_a1
                   FOR ALL ENTRIES IN i_lfabm1
                   WHERE objectclas = c_kred               "KRED
                   AND objectid EQ i_lfabm1-objectid       "Lifnr
                   AND ( tabname EQ c_lfa1 OR tabname EQ c_lfb1 OR tabname EQ c_lfm1 )          "LFA1, LFB1 and LFM1
                   AND ( fname EQ c_loevm OR fname OR fname EQ c_sperr )    "LOEVM, SPERR
                   AND value_new EQ c_x.
            IF sy-subrc EQ c_0.
              IF i_cdpos_a1[] IS NOT INITIAL.
    Select UDATE from CDHDR based on CHANGENR in CDPOS.
                SELECT objectclas
                       objectid
                       changenr
                       udate
                       FROM cdhdr
                       INTO TABLE i_cdhdr_a1
                       FOR ALL ENTRIES IN i_cdpos_a1
                       WHERE objectclas = c_kred             "KRED
                       AND  objectid EQ i_lfabm1-objectid               "Lifnr
                       AND changenr EQ i_cdpos_a1-changenr.   "(this is coming from CDPOS above selection)
    Here i got UDATE which have all the dates from 3 tables. I have to display in the output the field value (X) of LOEVM and UDATE for LFA1, SPERR value and UDATE for LFA1.Same way for other two tables, I have to display the UDATE and its field value (X). Where UDATE should be most recent date respectively.
    How can I populate the Recent date (UDATE) from one interal table for indvidual field values and table names.

  • Most recent data first in table view

     I am adding values to a display table like in the example, but I want the top row to be the newest data for the user to see. 
    It keeps adding to the bottom, and then the user would have to scrolll down to see all the data.      Can I select somehow the most recent data or get the table to auto scroll as data is applied?     I have tried shift registers as well but no luck.        
    Here is my VI
    Thanks
    Mike
    Solved!
    Go to Solution.
    Attachments:
    BasicTableExample.vi ‏11 KB

    Be aware that if you populate the table with a lot of data, its performance will get very slow.  You can work around this issue by only writing data to the table which the table is actually displaying.  To do this, you will need to use a scroll bar separate from the main table and the event structure to capture events.  If you run into this issue, let us know so we can provide some sample code.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • Most recently used values.

    In ABAP screens, the user can enter backspace in an input field and get a drop down of most recently used values. Has anyone implemented this or similar concept in Web Dynpro ? How to go about doing this ?
    Thanks.

    Kris,
    There is no such functionality in WD (at least, in WD Java). Also implementing same functionality is quite problematic: in WD it is impossible to assign key listeners and to do some on demand values loading (like Google Suggest).
    The most closest equivalent is tracking most recent values entered and then displaying them via <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/tutorial%20on%20advanced%20value%20help%20and%20object%20value%20selector%20-%209.htm">OVS</a>.
    Valery Silaev
    EPAM Systems
    http://www.NetWeaverTeam.com

  • Previous month is easy, what about most recent date WITH data?

    As the topic suggests, I've seen many posts with the following solution for returning the last date of the previous month: TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(CURRENT_DATE) * -1 , TIMESTAMPADD(SQL_TSI_MONTH, 1, CURRENT_DATE)).
    However, for at least the first few days of the current month, no data will be available for the previous month. How can I tell OBIEE to return the date for the most recent month where data exists?
    Another part of this puzzle, is that this request needs to play nicely with query rewrite in the view. the TIMESTAMPADD doesn't seem to use query rewrite well. Any suggestions?

    jzuzphreek wrote:
    As the topic suggests, I've seen many posts with the following solution for returning the last date of the previous month: TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(CURRENT_DATE) * -1 , TIMESTAMPADD(SQL_TSI_MONTH, 1, CURRENT_DATE)).
    However, for at least the first few days of the current month, no data will be available for the previous month. How can I tell OBIEE to return the date for the most recent month where data exists?
    Another part of this puzzle, is that this request needs to play nicely with query rewrite in the view. the TIMESTAMPADD doesn't seem to use query rewrite well. Any suggestions?For what you presented, the answer is simple. However, I suspect that your need is not as simple as you described. You describe your scenario as "there are no data for the previous month for the first few days of the current month." There are two inherent assumptions which if true, makes the problem not that difficult:
    1) Only the first few days of the current month, there are no data for the previous month (i.e., for the rest of the month, the data are there.)
    2) Data exists for every month.
    With these two assumptions, here is how you build your dashboard.
    1) Create a simple report with the key data fields run with the filter for "current month."
    For the "first few days" of the current month, this report will yield no records. (It doesn't matter how many days "a few days" is as you will see.) For the "rest of the month," this small report will always yield at least one record.
    2) Create your main report (call this Report A) that has a filter for "previous month."
    3) Place Report A on your dashboard in a Section.
    4) Click on the Properties of the Section and select "Guided Navigation" and have it point to the small report you built in step 1) that will display the section "if the request returns rows."
    5) Build another report (call this Report B) that has a filter for "two months ago."
    6) Place Report B in a separate Section on your dashboard, below the Section in step 3).
    7) Click on the Properties of this Section and again select "Guided Navigation," have it point to the small report from step 1), but this time have it display "if the request returns no rows."
    So here's what happens. For the first few days of "this month," the small report will return no rows. The top Section will not display, but the bottom one will, which has as its filter "two months ago." The assumption is that by the end of each month, there will always be data. This therefore meets your criteria of displaying "the most recent month where data exists." Once data for "this month" is available, the top Section will display with the current month's filter. The bottom section will not appear until the "first few days" of the next month.
    That's how you do it.

  • Highlighting the most recent date in a row

    hi all
    I have a series of 5 dates in a row. I would like to be able to highlight only the cell containing the most recent date (in respect to the current date) in each row.
    There will be instances when there is no date in some of the cells.
    Thanks for the help in the past, this and the other forums are awesome.

    Jason is correct. It requires two tables.
    I had started experimenting with this last night, but an outage at my ISP prevented posting at that time.
    Conditional formatting of a cell depends on comparing the value in that cell with a fixed value contained in the rule; the rule itself cannot reference a different cell to pick up the comparison value. So you need to calculate a value in a cell on a second table, apply conditional formatting to that cell, and place it directly behind the cell containing the date to be highlighted.
    Example:
    Dates are in cells B7 to F7 of Table 1
    Cell H1 is used to select the maximum date.
    Table 2 is a single row table with no row or column header cells, and only 5 columns.
    Select Table 1, open the Inspector, and use the Table inspector to set Cell Background to “None”
    In Cell H1 enter: =MAX(B7:F7)
    Go Insert > Table > Plain
    Resize the new table (Table 2) to 1 row x 5 columns.
    In A1 of Table 2, enter: =DATEDIF(Table 1::B7,Table 1::$H7,"D")
    Drag the handle at the lower right of the cell to copy the formula into all five cells.
    Click on A1.
    Open the Inspector and choose the Cell Format inspector.
    Check the Conditional Format checkbox, then click Show rules...
    Set the rule to “Equal to... 0”
    Choose a Fill colour to serve as your highlight colour.
    Click on the next cell and repeat.
    When you have applied the rule to all five cells, close the Conditional Format dialogue.
    Choose all five cells. Open the Text inspector.
    Click on the colour well.
    Leave the text colour set at Black, but move the Opacity slider to 0%.
    Close the Inspector and the Colors dialogue.
    Select Table 2 and drag it into position covering the five cells with dates on Table 1. Use the Arrow keys to nudge it into exact alignment.
    Go Arrange > Send Backward to move Table 2 behind Table 1. Repeat until you can see the dates on Table 1.
    Regards,
    Barry

  • Most recent date with two other conditions met

    Ok, so I'm sure somebody is going to suggest that I do a search first before posting on here.  So let me assure you, that I have exhausted all search possibilities that I could possibly think of before registering to post on here.  I've read a lot of good suggestions that got me just as far as I was getting on my own, because I couldn't find any posts of somebody asking exactly what I'm looking to do.  I have tried quite close to 100 different formulas without achieving the desired results.
    I'm a pilot, and I track all of my flights myself in a very well organized(I think so ) Numbers spreadsheet that I've been tweaking and perfecting over the past few years.  I have created plenty of formulas in it, and they all work great...except ONE.
    I've created a simplified version of the columns I am trying to match specific conditions with.  Essentially, I need the formula to return the most recent date(column 1), that is completed during a night time flight status(column 2), that is equal to or greater than 1.0 flight hours(column 3).
    As you can see, by evaluating the table below, the correct formula should return to me:        8-4-13
    The closest I've come to getting the correct results was with a "LOOKUP" formula, but I could not figure out how to get it to properly assess whether it was equal to or greater than 1.0 hours of flight, thus returning me the wrong date EVERYTIME(the most recent night flight period).
    I'm sure I've gotten close at least a few times, but I need some help getting this final formula figured out.  I really appreciate anybody's input on this.
    Date
    Flight Status
    Flight Hours
    8-1-13
    D
    2.4
    8-2-13
    N
    3.0
    8-3-13
    N
    1.1
    8-4-13
    N
    1.3
    8-5-13
    D
    2.2
    8-6-13
    N
    0.5
    8-7-13
    D
    1.1

    This may work and requires and extra column in your Data entry table (the one you provided in your post).  You can hide this new column.
    D2=IF(AND(C2>=1, B2="N"), A2, "")
    select D2 and fill down as needed.
    The table on the right is a summary table and is set up as follows:
    B2=MAX(Data :: D)
    I hope this is helpful

  • Most recent date formula

    I need the formula to calculate the most recent date.

    Hi,
    Just go to the formula fields and create New formula.write folowing formulae.
    Maximum(Your Date Field)
    Regards
    Kiran

Maybe you are looking for