Select record according to latest date

I have two fields in my DB table , one is region and other is date .
There are many records for region (R1 lets say).
My requirement is that I want the record (only one record) with the latest date for this region .

hi,
try like this.
SELECT - aggregate
Syntax
... { MAX( [DISTINCT] col )
    | MIN( [DISTINCT] col )
    | AVG( [DISTINCT] col )
    | SUM( [DISTINCT] col )
    | COUNT( DISTINCT col )
    | COUNT( * )
    | count(*) } ... .
Effect
As many of the specified column labels as you like can be listed in the SELECT command as arguments of the above aggregate expression. In aggregate expressions, a single value is calculated from the values of multiple rows in a column as follows (note that the addition DISTINCT excludes double values from the calculation):
MAX( [DISTINCT] col ) Determines the maximum value of the value in the column col in the resulting set or in the current group.
MIN( [DISTINCT] col ) Determines the minimum value of the content of the column col in the resulting set or in the current group.
AVG( [DISTINCT] col ) Determines the average value of the content of the column col in the resulting set or in the current group. The data type of the column has to be numerical.
SUM( [DISTINCT] col ) Determines the sum of the content of the column col in the resulting set or in the current group. The data type of the column has to be numerical.
COUNT( DISTINCT col ) Determines the number of different values in the column col in the resulting set or in the current group.
COUNT( * ) (or count(*)) Determines the number of rows in the resulting set or in the current group. No column label is specified in this case.
reward if useful.

Similar Messages

  • Finding the record with the latest date

    Post Author: sconlon
    CA Forum: General
    Hi,I am using CR 8 with an Access database which has a table that holds (multiple) sales records for each of our clients. I want to create a report that lists only the latest sale from each client.  I am thinking that I first need to group by client and then create a sub-report that prints the necessary details of sales record with the latest date of sale.  It's this last bit that I cannot figure out how to do.  Can anyone suggest a way of doing this?Many thanks,sconlon

    Post Author: Jagan
    CA Forum: General
    Charliy's suggestion if fine, and does require sorting and displaying in the group header/footer according to the sort order. In case it's not clear, when you print in the group header you are using the first record's data; when you print in the group footer you are using the last record's data (first and last within the group that is).
    Personally, I'd group on the client have a group selection formula of:
    {table.date_field} = maximum({table.date_field}, {table.client_id})
    so that there's no date sort required as you'll only get one record per client group - assuming that each record has a unique date of course. I'd probably still suppress the details section and display in the group footer, but it wouldn't matter if you use the details section either.
    I believe the benefit with the group selection formula is that any summary formulas, running totals etc. you use would only have the one record per client to work on, rather than including all of the suppressed records too.

  • Discoverer: Capturing record with the latest date among others

    Hi there,
    I would appreciate if anyone can help me in Discoverer10g Report. The report gives me the following results. Let me know if any more info needed.
    Example:
    Plan Cov St Dt Amt Elec. Dt Name Rt St dt Comm Ann Enrl Cov St Dt
    Basic Life     01-JAN-2011     76000.00     11-NOV-2010     Stephanie     01-JAN-2011          2.63      68.40     11-NOV-2010     
    Basic Life     01-JAN-2011     76000.00     29-OCT-2010     Stephanie     01-JAN-2011          2.63      68.40     29-OCT-2010     (Yes)
    Basic Life     01-JAN-2011     177000.00     29-OCT-2010 Shanika     01-JAN-2011          6.13      159.30     29-OCT-2010     (Yes)
    Basic Life     01-JAN-2011     214000.00     19-NOV-2010     Nicole     01-JAN-2011          7.41      192.60     19-NOV-2010     (Yes)
    Basic Life     01-JAN-2011     214000.00     29-OCT-2010     Nicole     01-JAN-2011          7.41      192.60     29-OCT-2010
    What I want to capture is latest date record from available records of the same employee and if there is only one record, I would want that too. In short, the ones which has '(yes)' at the end.
    What function can I use to get the desired results.
    Thank you!
    NN

    Hi Tamir,
    I used the the function(for another report which has similar situation) you mentioned but it gives me an error saying-
    ORA-01858: a non-numeric character was found where a numeric was expected.
    Its is OAB module indeed. some how due to date issue during our Insurance Vendor changes, I get multiple records of the same employees with some blank fields. See the example below.
    *4.36     07-AUG-2010     31-DEC-4712     07-AUG-2010     07-AUG-2010     21206*
    NULL     07-AUG-2010     31-DEC-4712     07-AUG-2010          21206
    3.95     01-JAN-2010     31-DEC-4712     01-JAN-2010     01-JAN-2010     21206
    Now out of three I need the one in bold letters. and there are other employees having just one record like
    Amt   Cov_St_DT         Cov_End_Dt       Rate_St_Date    Rt_Effective Dt  EEID
    1.45     15-SEP-2010     31-DEC-4712     15-SEP-2010     15-SEP-2010     22777
    7.65     01-JAN-2010     31-DEC-4712     01-JAN-2010     01-JAN-2010     21298
    so I need the single records as well as latest(date) record of multiple records of one employee.
    Let me know if you need more information.
    One more thing- is there any way to see the actual query I am running?(not sql Inspector)
    Thank you!
    797174
    p.s Thank you for the earlier reply.
    Edited by: 797174 on Dec 21, 2010 2:18 PM

  • Select record having most recent date

    Table: Order
    Code     ImportId     EntryDate
    1 100
    10/11/2014
    1 101
    10/14/2014
    1 102
    10/10/2014
    2  103  10/11/2014
    2   104  10/15/2014
    I want to select the record having the most recent EntryDate grouped by Code. In the select, i need to return the ImportId.
    Anonymous

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Nothing you posted
    was right. Temporal data should use ISO-8601 formats. This is the only format allowed in the ANSI-ISO SQL Standards and it is the most common IT standard on Earth; but you do not know it! 
    Code should be in Standard SQL as much as possible and not local dialect. There is no such crap as a generic “code” in RDBMS. Table have keys, so you have no table! Rows are not records; this is a basic concept. 
    This is minimal polite behavior on SQL forums. Here is my guess at what a polite, competent person might have posted. 
    CREATE TABLE Import_Orders
    (order_type INTEGER NOT NULL
     CHECK(order_type IN (1,2)),
     import_id CHAR(3) NOT NULL PRIMARY KEY, 
     entry_date DATE NOT NULL);
    INSERT INTO Import_Orders
    VALUES
    (1, 100, '2014-10-11'),
    (1, 101, '2014-10-14'),
    (1, 102, '2014-10-10'),
    (2, 103, '2014-10-11'),
    (2, 104, '2014-10-15');
    I want to select the record [sic] having the most recent entry_date grouped by order_type. In the select, I need to return the import_id.
    If you return only the import_id, then the most recent entry_date does not matter! Think about it! Did you want the whole row with the most recent entry_date? Here is a common idiom. 
    WITH X (import_id, order_type, entry_date, entry_date_max)
    AS
    (SELECT import_id, order_type, entry_date, 
            MAX(entry_date) OVER (PARTITION BY order_type)
       FROM Import_Orders) 
    SELECT import_id, order_type, entry_date
      FROM X
     WHERE entry_date = entry_date_max;
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Choosing unique record based on latest date

    I have a column, say Name, in which a person's name appears with multiple transactions. Each transaction has an unique date. I want to return just the latest transaction by date for each person.
    If I write my select as:
    select Name, Trans_Dt from <Table>;
    I of course get a list of all transactions listing person and date.
    I've tried this:
    select Name, Trans_Dt from <Table>
    group by Trans_Dt having greatest(Trans_Dt).
    This doesn't work. Any suggestions?

    select name, trans_dt
    from
       select
          Name,
          Trans_Dt,
          max(Trans_Dt) over(partition by name) as max_trans_date
       from <Table>
    where Trans_Dt= max_Trans_trans_date;Would be one way.

  • Select records based on max(date)

    Hi everyone,
    I have a table (tbl_training) with training information-such as who took what training, when they took it, scores they received and other various stuff.
    In this table, a person could have taken multiple training within the year. what i need to see in my results is, the last training the person took. I assume i am looking to query something that produces max(date_of_training) and maybe grouping my id_number. I have tried various combinations of sub-queries to no avail. Any help is welcomed.
    So my data may look something like this:
    id_number date_of_training score last_name first_name instructor rank
    1234 01/01/09 50 doe john mr. hank sgt
    1234 02/13/09 72 doe john mr. hank sgt
    1234 01/31/09 60 doe john mr. hank sgt
    5678 02/03/09 80 smith lisa mr. hank cpl
    What i need returned in the query is:
    1234 02/13/09 72 doe john mr. hank sgt
    5678 02/03/09 80 smith lisa mr. hank cpl
    Select id_number, date_of_training, score, last_name, first_name, instructor, rank
    from tbl_training;
    Thanks for the help in advance.

    Try this code
    select * from (
    Select id_number, date_of_training, score, last_name, first_name, instructor, rank, row_number()over(partition by id_number order by date_of_training desc ) rn
    from tbl_training)
    where rn =1;

  • Getting the last set of records based on a Date Field

    Hi All
    i have the followings data set in a table
    TRACK_ID_GRP     TRACK_ID_NBR     TRACK_SAMPLE_ID     START_DATE
    970150                      129700104071     64260                        8/6/2002
    970150                      229700101893     64261                        8/6/2002
    970150                     149700101893     64262                        8/6/2002
    970150                       97015011     79252                        9/19/2005
    970150                       97015023     79255                        9/19/2005
    970150                       97015013     79253                         9/19/2005
    970150                       97015021     79254                        9/19/2005
    970040                      129900105213     56155                         9/26/2000
    970040                                 1101     29841                        6/9/1998
    970040                       97004023     143349                        10/28/2008
    970040                              2101     29842                        6/9/1998
    970040                        97004021     143348                        10/28/2008
    970040                       97004011     143346                        10/28/2008
    970040                      149700101903     64196                       7/16/2002
    970040                              2301     29844                      6/9/1998
    970040                         97004013     143347                         10/28/2008
    970040                                  1301       29843                        6/9/1998I need to get only those records with the latest date and i'm using the following query
    SELECT t.track_id_grp, t.track_id_nbr, t.track_sample_id,
           MAX (t.start_date) OVER (PARTITION BY t.track_id_grp) AS start_date
      FROM track_table t
    WHERE t.track_id_grp IN ('970150', '970040')And i'm getting the following dataset
    TRACK_ID_GRP     TRACK_ID_NBR     TRACK_SAMPLE_ID     START_DATE
    970040                      1.299E+11     56155     10/28/2008
    970040                      1101                     29841     10/28/2008
    970040                      97004023                     143349     10/28/2008
    970040                      2101                     29842     10/28/2008
    970040                      97004021                     143348     10/28/2008
    970040                      97004011                     143346     10/28/2008
    970040                      1.497E+11     64196     10/28/2008
    970040                      2301                     29844     10/28/2008
    970040                      97004013                     143347     10/28/2008
    970040                      1301                     29843     10/28/2008
    970150                      1.297E+11     64260     9/19/2005
    970150                      97015011                     79252     9/19/2005
    970150                      97015021                     79254     9/19/2005
    970150                      2.297E+11     64261     9/19/2005
    970150                      97015013                     79253     9/19/2005
    970150                      97015023                     79255     9/19/2005
    970150                      149700101903     64262     9/19/2005And i was expecting the following dataset
    TRACK_ID_GRP     TRACK_ID_NBR     TRACK_SAMPLE_ID     START_DATE
    970150                      97015011                             79252     9/19/2005
    970150                      97015023                             79255     9/19/2005
    970150                      97015013                             79253     9/19/2005
    970150                      97015021                             79254     9/19/2005
    970040                      97004023                             143349     10/28/2008
    970040                      97004021                             143348     10/28/2008
    970040                      97004011                             143346     10/28/2008
    970040                      97004013                             143347     10/28/2008I was expecting to get only those records with the latest date, instead i'm getting all the records with the max date in it, please need help or advice.
    Thanks

    Try this -
    SELECT track_id_grp, track_id_nbr, track_sample_id, start_date
      FROM (SELECT t.track_id_grp, t.track_id_nbr, t.track_sample_id,
                   t.start_date,
                   ROW_NUMBER () OVER (PARTITION BY t.track_id_grp, t.track_sample_id ORDER BY t.start_date DESC)
                                                                            AS rn
              FROM track_table t
             WHERE t.track_id_grp IN ('970150', '970040'))
    WHERE rn = 1let me know if that works.
    Edited by: Sri on Apr 28, 2011 9:24 AM

  • How to Check the date and get the latest date?

    Hi Everyone,
    I've an internal table which holding few records which contain date field. How I can check this internal table by getting the record which contain "latest date" only? Kindly advise. Thank you.
    eg:
    I should only get the record which contain lastest date. (eg: I should picked up Record3)
    Table i_test
    Field 1              Field 2(date)
    Record1            20090322
    Record2            20090101
    Record3            20090601
    Moderator message - Please search before asking and do not ask basic questions - post locked
    Edited by: Rob Burbank on Jun 17, 2009 9:21 AM

    Its easy...sort the internal table using the field i.e. date field in DESCENDING manner
    SORT gt_final BY date_field DESCENDING.
    Read the first entry of the internal table..it will have what you require
    READ gt_final INDEX 1.

  • Get the latest date record in Query

    Hi, Expert:
    Please help on this:
    The requirement is to get the the latest date record in Query. For example:
    Data in provider:
    Plant          date            amount
    A01         2007/04/08      30
    A01         2007/06/09      70
    A01         2007/12/08      30
    we only want the query display:
    A01         2007/12/08      30
    I have tried exception aggregation, but it does not work. Any ideas are highly appreciated.

    Or you can model the date as a key figure after 0date_kyf and set aggregation to max, you'll get something like
    select plant, amount, max(date) from ... group by plant, amount
    used it for inventory reporting (materials and their last movement date, days from the last movement etc.) and worked well.

  • Select records based on monthly anniversary date

    Hi,
    I have a table with a date_added field and I want to select records based on the monthly anniversary date of this field.
    eg. ID, Date_added
    1, 10-DEC-2012
    2, 11-NOV-2012
    3, 10-MAR-2012
    4, 28-FEB-2012
    5, 30-DEC-2012
    So For the 10th of Jan 2013, I would want to return records 1 and 3 only
    I started looking at the extract function, but this soon falls down for records at the end of the month. For example, on the 28th Feb, I would also want to include records where the date_added day is the 29th, 30th or 31st. So, in the table above I would want to return records 4 and 5, but extract would only return 4.
    Is there a simple function to do this month anniversary query - am I missing something very obvious? Or, do I need to write a query to explicitly cope with dates at the end of the month? So far I haven't found a sensible simple solution!
    I'm using 11g
    thanks

    I didn't look into leap year, but this should give you a starting point:
    select  *
      from  t
      where 1 = case last_day(to_date(:target_date,'mmddyyyy'))
                  when to_date(:target_date,'mmddyyyy')
                    then case
                           when to_char(date_added,'dd') >= to_char(to_date(:target_date,'mmddyyyy'),'dd')
                             then 1
                         end
                  else case
                           when to_char(date_added,'dd') = to_char(to_date(:target_date,'mmddyyyy'),'dd')
                             then 1
                         end
                end
    /For example, target date is 1/10/2013:
    SQL> variable target_date varchar2(8)
    SQL> exec :target_date := '01102013';
    PL/SQL procedure successfully completed.
    SQL> with t as (
      2             select 1 id,to_date('10-DEC-2012','dd-mon-yyyy') date_added from dual union all
      3             select 2,to_date('11-NOV-2012','dd-mon-yyyy') from dual union all
      4             select 3,to_date('10-MAR-2012','dd-mon-yyyy') from dual union all
      5             select 4,to_date('28-FEB-2012','dd-mon-yyyy') from dual union all
      6             select 5,to_date('30-DEC-2012','dd-mon-yyyy') from dual
      7            )
      8  select  *
      9    from  t
    10    where 1 = case last_day(to_date(:target_date,'mmddyyyy'))
    11                when to_date(:target_date,'mmddyyyy')
    12                  then case
    13                         when to_char(date_added,'dd') >= to_char(to_date(:target_date,'mmddyyyy'),'dd')
    14                           then 1
    15                       end
    16                else case
    17                         when to_char(date_added,'dd') = to_char(to_date(:target_date,'mmddyyyy'),'dd')
    18                           then 1
    19                       end
    20              end
    21  /
            ID DATE_ADDE
             1 10-DEC-12
             3 10-MAR-12
    SQL> And target date is 2/28/2013:
    SQL> exec :target_date := '02282013';
    PL/SQL procedure successfully completed.
    SQL> with t as (
      2             select 1 id,to_date('10-DEC-2012','dd-mon-yyyy') date_added from dual union all
      3             select 2,to_date('11-NOV-2012','dd-mon-yyyy') from dual union all
      4             select 3,to_date('10-MAR-2012','dd-mon-yyyy') from dual union all
      5             select 4,to_date('28-FEB-2012','dd-mon-yyyy') from dual union all
      6             select 5,to_date('30-DEC-2012','dd-mon-yyyy') from dual
      7            )
      8  select  *
      9    from  t
    10    where 1 = case last_day(to_date(:target_date,'mmddyyyy'))
    11                when to_date(:target_date,'mmddyyyy')
    12                  then case
    13                         when to_char(date_added,'dd') >= to_char(to_date(:target_date,'mmddyyyy'),'dd')
    14                           then 1
    15                       end
    16                else case
    17                         when to_char(date_added,'dd') = to_char(to_date(:target_date,'mmddyyyy'),'dd')
    18                           then 1
    19                       end
    20              end
    21  /
            ID DATE_ADDE
             4 28-FEB-12
             5 30-DEC-12
    SQL> SY.

  • SELECT records larger than date specified in sub query

    Dear All
    Thank you for your attention.
    I would like to select records larger than date specified in sub query
    query should be something like the following
    SELECT my_order_number, my_date, my_task
    FROM MYTB
    WHERE my_order_number IN order_no AND my_date > date (SELECT order_no, date FROM MySubQueryResult)
     (it is incorrect)
    Sub query result:
    order_no | date
    A1    | 2014-12-21 09:06:00
    A2    | 2014-12-20 09:07:00
    A3    | 2014-12-20 08:53:00
    A4    | 2014-12-20 08:57:00
    MYTB:
    my_order_number | my_task | my_date
    A1  |  T1  |  2014-12-21 09:06:00
    A1  |  T2  |  2014-12-22 10:01:00
    A2  |  T1  |  2014-12-20 09:07:00
    A3  |  T2  |  2014-12-20 08:53:00
    A3  |  T4  |  2014-12-21 09:30:00
    A3  |  T8  |  2014-12-23 20:32:00
    A4  |  T6  |  2014-12-20 08:57:00
    expected result:
    my_order_number |  my_task | my_date
    A1  |  T2  |  2014-12-22 10:01:00
    A3  |  T4  |  2014-12-21 09:30:00
    A3  |  T8  |  2014-12-23 20:32:00
    Any ideas?  Thanks.
    swivan

    Hi,
    try this
    SELECT my_order_number, my_date, my_task
    FROM MYTB
    WHERE my_order_number IN (SELECT order_no FROM MySubQueryResult)
    AND my_date > (SELECT date FROM MySubQueryResult)
    Alternatively, you can also make use of joins to achieve the same.
    Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker
    Praveen Dsa | MCITP - Database Administrator 2008 |
    My Blog | My Page
    Dear Praveen Dsa
    Thanks for your reply, but order_no and date are paired and related, cannot separate.
    each order have its own date, so it is not working
    Best Regards
    swivan

  • Sql query - Selecting last recorded values for each date in specified period

    Hello,
    Can someone please help me with my problem.
    I'm trying to get last recorded balance for each day for specific box (1 or 2) in specified period of days from ms access database using ADOTool.
    I'm trying to get that information with SQL query but so far unsuccessfully...  
    My table looks like this:
    Table name: TestTable
    Date Time Location Box Balance
    20.10.2014. 06:00:00 1 1 345
    20.10.2014. 12:00:00 1 1 7356
    20.10.2014. 18:45:00 1 1 5678
    20.10.2014. 23:54:00 1 1 9845
    20.10.2014. 06:00:02 1 2 35
    20.10.2014. 12:00:04 1 2 756
    20.10.2014. 18:45:06 1 2 578
    20.10.2014. 23:54:10 1 2 845
    21.10.2014. 06:00:00 1 1 34
    21.10.2014. 12:05:03 1 1 5789
    21.10.2014. 15:00:34 1 1 1237
    21.10.2014. 06:00:00 1 2 374
    21.10.2014. 12:05:03 1 2 54789
    21.10.2014. 15:00:34 1 2 13237
    22.10.2014. 06:00:00 1 1 8562
    22.10.2014. 10:00:00 1 1 1234
    22.10.2014. 17:03:45 1 1 3415
    22.10.2014. 22:00:00 1 1 6742
    22.10.2014. 06:00:05 1 2 562
    22.10.2014. 10:00:16 1 2 123
    22.10.2014. 17:03:50 1 2 415
    22.10.2014. 22:00:10 1 2 642
    23.10.2014. 06:00:00 1 1 9876
    23.10.2014. 09:13:00 1 1 223
    23.10.2014. 13:50:17 1 1 7768
    23.10.2014. 19:47:40 1 1 3456
    23.10.2014. 21:30:00 1 1 789
    23.10.2014. 23:57:12 1 1 25
    23.10.2014. 06:00:07 1 2 976
    23.10.2014. 09:13:45 1 2 223
    23.10.2014. 13:50:40 1 2 78
    23.10.2014. 19:47:55 1 2 346
    23.10.2014. 21:30:03 1 2 89
    23.10.2014. 23:57:18 1 2 25
    24.10.2014. 06:00:55 1 1 346
    24.10.2014. 12:30:22 1 1 8329
    24.10.2014. 23:50:19 1 1 2225
    24.10.2014. 06:01:00 1 2 3546
    24.10.2014. 12:30:26 1 2 89
    24.10.2014. 23:51:10 1 2 25
    Let's say the period is 21.10.2014. - 23.10.2014. and I want to get last recorded balance for box 1. for each day. The result should look like this:
    Date Time Location Box Balance
    21.10.2014. 15:00:34 1 1 1237
    22.10.2014. 22:00:00 1 1 6742
    23.10.2014. 23:57:12 1 1 25
    So far I've managed to write a query that gives me balance for ONLY ONE date (date with highest time in whole table), but I need balance for EVERY date in specific period.
    My incorrect code (didn't manage to implement "BETWEEN" for dates...):
    SELECT TestTable.[Date], TestTable.[Time], TestTable.[Location], TestTable.[Box], TestTable.[Balance]
    FROM TestTable
    WHERE Time=(SELECT MAX(Time)
    FROM TestTable
    WHERE Location=1 AND Box=1 );
    Tnx!
    Solved!
    Go to Solution.

    For loop
    following query keep day (here 24 in below query) Variable from ( 1 to 28-29/30/31 as per month)
    SELECT TOP 1 TestTable.[Date], TestTable.[Time], TestTable.[Location], TestTable.[Box], TestTable.[Balance]
    FROM Test Table.
    WHERE  Time=(SELECT MAX(Time) FROM TestTable WHERE Location=1 AND Box=1 )
    AND DATE = "2014-10-24";
    PBP (CLAD)
    Labview 6.1 - 2014
    KUDOS ARE WELCOMED.
    If your problem get solved then mark as solution.

  • Adobe form displaying data of previous selected records

    Dear All,
    I have created a wd component consisting of 2 views.
    In the first view i am displaying an ALV. When i select a record and click on the alv button, the second view
    gets called which contains an Adobe Form showing the data.
    The problem i am facing is that the record which gets displayed in the adobe form is the one previous selected record and not the current record which i select.
    Kindly give your valuable suggestions .
    Regards,
    Niti

    Hi ,
    Adobe form is just an external media in your case , it has nothing to do with your data.
    Check what data is getting passed to adobe form via debuging .
    check if your getting the selected element .
    You can also post your code here if possible.
    Regards
    Kuldeep

  • Select Records between Begin Date/Time and End Date/Time

    Hi, I need to select records from table GLPCA where the CPUDT and CPUTM are between a START DATE/TIME and END DATE/TIME. 
    I have the below logic from an SAP Solution, but it doesn't seem to be working right in my opinion.  It is picking up records earlier than the date ranges.  Can anyone tell me how I might be able to accomplish this?  I'm hoping this is an easy one for the ABAPPERs... 
    Thanks,
    START DATE 20091022
    START TIME 125736
    END DATE 20091022
    END TIME 135044
    CPUDT 20091022
    CPUTM 100257
          SELECT * FROM GLPCA
             WHERE ( CPUDT >= STARTDATE AND ( CPUTM >= STARTTIME OR ( CPUDT <= ENDDATE AND CPUTM <= ENDTIME ) ) ).

    Thank you all!  I ended up using the following:
    SELECT * FROM GLPCA
              WHERE RYEAR IN L_R_RYEAR
                AND ( ( CPUDT = STARTDATE AND CPUTM >= STARTTIME ) OR CPUDT > STARTDATE )
                AND ( ( CPUDT = ENDDATE   AND CPUTM <= ENDTIME )   OR CPUDT < ENDDATE ).
    This child was born from the following thread that was found:
    update date and time of client record

  • Selecting records from multiple dates but specific time

    Hi:
    I've to select records of multiple dates but the time should be 00:00:00 to 06:00:00 (i.e. 12 AM - 6 AM)
    For date part this can be done:
    WHERE
    START_TIME BETWEEN TO_DATE('04-01-2012', 'MM-DD-YYYY') AND TO_DATE('04-05-2012', 'MM-DD-YYYY')
    But how can I fix the time mentioed above.
    Please let me know.
    Thanks/Tanvir

    WHERE
    START_TIME BETWEEN TO_DATE('04-01-2012', 'MM-DD-YYYY') AND TO_DATE('04-05-2012', 'MM-DD-YYYY')
    and start_time - trunc(start_time) between 0 and 6/24start_time - trunc(start_time) will give you the fraction of a day. So 6/24 means 06:00.
    (When you use to_char(trunc(sysdate,'hh'),'hh24') between 0 and 6 you will also retrieve records with start_time 06:01 for example. So this would not meet your requirements as far as I understood.)
    Edited by: hm on 10.04.2012 01:26

Maybe you are looking for

  • Errors found when running the example of "Five XSLT 2.0 Features ..."

    Does anyone encounter the error "XSL-1015: (Error) Function 'current-group' not found" when running Oraxsl grouping_20.xsl? Despite I followed exactly what memtioned in the article, it still did not work. Thank you very much.

  • Urgent! PowerMac G5 Smells Like It's Burning;  Red Warning Light!

    I have a paper due today, and the only copies of it are on a PowerMac G5 (Early 2005, 2.0 GHz, OS X 10.4.11) and a USB flash drive that I can't use with any of our Windows laptops. Power Mac G5 (Early 2005) - Technical Specifications I was using the

  • Developing a site layout like Apple's Website

    I layout and ease of use of apples website. I would like a similar layout for an information site I will be creating. The scroll features and the drop down features: can those be created using iweb? Is there a template that is similar to the pages of

  • DAIL PAD NOT WORKING

    In BB the dial pad is not responding, only "0" is working no other keys are responding like 1 2 3 4 5 6 7 8 9... rest of tuch screen is working fine. Pls. help

  • I can't install firefox.

    when i open about firefox, firefox just says updates available at www.mozilla.org/firefox, but when i go there, it just says that i'm using the latest version of firefox. and i'm not changing my user agent string.