Query Help pls dates and logic.

Hi all gurus
I have a need where I need to put togahter series of timeline events that occurred in past as a one row concerning dates.
This is my table .
  CREATE TABLE "SORS"."SOR_TRACKING"
   ( "TRACKING_ID" NUMBER NOT NULL ENABLE,
  "LETTER_ID" NUMBER NOT NULL ENABLE,
  "OFFENDER_ID" NUMBER NOT NULL ENABLE,
  "LOCATION_ID" NUMBER NOT NULL ENABLE,
  "OFFICE_ID" NUMBER,
  "MAIL_DATE" DATE DEFAULT SYSDATE NOT NULL ENABLE,
  "RESPONSE_DATE" DATE,
  "STATUS" VARCHAR2(30 BYTE) DEFAULT 'Mailed',
  "ENTRY_DATE" DATE DEFAULT SYSDATE NOT NULL ENABLE,
  "ENTRY_USER" VARCHAR2(30 BYTE) NOT NULL ENABLE,
  "COMMENTS" VARCHAR2(2000 BYTE),
  "FIRST_NAME" VARCHAR2(80 BYTE) NOT NULL ENABLE,
  "MIDDLE_NAME" VARCHAR2(80 BYTE),
  "LAST_NAME" VARCHAR2(80 BYTE) NOT NULL ENABLE,
  "SIR_NAME" VARCHAR2(30 BYTE),
  "ADDRESS1" VARCHAR2(80 BYTE),
  "ADDRESS2" VARCHAR2(80 BYTE),
  "CITY" VARCHAR2(50 BYTE),
  "STATE" VARCHAR2(30 BYTE),
  "ZIP" VARCHAR2(20 BYTE),
  "COUNTY" VARCHAR2(80 BYTE),
  "OFFENDER_TYPE" VARCHAR2(30 BYTE),
  "LAST_MAIL_DATE" DATE,
  "BATCH_ID" NUMBER NOT NULL ENABLE,
  "JURISDICTION" NUMBER,
  "DL_NAME" VARCHAR2(60 BYTE),
  "DL_OFFICE" VARCHAR2(60 BYTE),
  "DL_ADDRESS" VARCHAR2(60 BYTE),
  "DL_MAILING_ADDRESS" VARCHAR2(60 BYTE),
  "DL_CITY" VARCHAR2(60 BYTE),
  "DL_STATE" VARCHAR2(30 BYTE),
  "DL_ZIP" VARCHAR2(20 BYTE),
  "TITLE" VARCHAR2(10 BYTE),
  "MODIFIED_USER" VARCHAR2(30 BYTE),
  "MODIFIED_DATE" DATE,
  CONSTRAINT "PK_SOR_TRACKING" PRIMARY KEY ("TRACKING_ID"))
Sample date
REM INSERTING into SOR_TRACKING
SET DEFINE OFF;
Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (781410,1,4557,110207,2809,to_date('05-NOV-13','DD-MON-RR'),null,'Mailed',to_date('05-NOV-13','DD-MON-RR'),'NEEL',null,'BOB','Jolene','Luna',null,'20535 Valleyview Rd ',null,'Boo','OK','74840','potter','STANDARD',to_date('15-FEB-12','DD-MON-RR'),30211,2809,null,null,null,null,null,null,null,'Ms.','NEEL',to_date('05-NOV-13','DD-MON-RR'));
Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (190294,1,4557,110207,2809,to_date('08-FEB-12','DD-MON-RR'),to_date('15-FEB-12','DD-MON-RR'),'Verified',to_date('17-FEB-12','DD-MON-RR'),'Casper',null,'BOB','Jolene','Luna',null,'20535 Valleyview Rd ',null,'Boo','OK','74840','potter','STANDARD',to_date('13-DEC-11','DD-MON-RR'),28442,2809,null,null,null,null,null,null,null,'Ms.',null,null);
Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (184647,1,4557,110207,2809,to_date('05-DEC-11','DD-MON-RR'),to_date('13-DEC-11','DD-MON-RR'),'Verified',to_date('15-DEC-11','DD-MON-RR'),'Casper',null,'BOB','Jolene','Luna',null,'20535 Valleyview Rd ',null,'Boo','OK','74840','potter','STANDARD',to_date('09-NOV-11','DD-MON-RR'),27985,2809,null,null,null,null,null,null,null,'Ms.',null,null);
Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (157253,1,4557,102288,2809,to_date('03-FEB-11','DD-MON-RR'),null,'Mailed',to_date('03-FEB-11','DD-MON-RR'),'Casper',null,'BOB','Jolene','Luna',null,'PO Box 146',null,'Boo','OK','74840','potter','STANDARD',to_date('08-NOV-10','DD-MON-RR'),25613,2809,null,null,null,null,null,null,null,'Ms.',null,null);
Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (149710,1,4557,102288,2809,to_date('01-NOV-10','DD-MON-RR'),to_date('08-NOV-10','DD-MON-RR'),'Verified',to_date('16-NOV-10','DD-MON-RR'),'Casper',null,'BOB','Jolene','Luna',null,'PO Box 146',null,'Boo','OK','74840','potter','STANDARD',to_date('18-OCT-10','DD-MON-RR'),24939,2809,null,null,null,null,null,null,null,'Ms.',null,null);
Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (138268,1,4557,99564,2809,to_date('03-JUN-10','DD-MON-RR'),to_date('17-JUN-10','DD-MON-RR'),'Letter Returned',to_date('17-JUN-10','DD-MON-RR'),'Boo','Post office: No mail receptacle','BOB','Jolene','Luna',null,'20535 Valley View Rd.',null,'Boo','OK','74840','potter','STANDARD',to_date('19-MAY-10','DD-MON-RR'),24216,2809,null,null,null,null,null,null,null,'Ms.',null,null);
Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (128798,1,4557,91503,2809,to_date('04-FEB-10','DD-MON-RR'),null,'Mailed',to_date('04-FEB-10','DD-MON-RR'),'Casper',null,'BOB','Jolene','Luna',null,'PO Box 146',null,'Boo','OK','74840','potter','STANDARD',to_date('10-NOV-09','DD-MON-RR'),23369,2809,null,null,null,null,null,null,null,'Ms.',null,null);
Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (115073,1,4557,91503,2809,to_date('07-AUG-09','DD-MON-RR'),to_date('10-NOV-09','DD-MON-RR'),'Verified',to_date('10-NOV-09','DD-MON-RR'),'Boo',null,'BOB','Jolene','Luna',null,'PO Box 146',null,'Boo','OK','74840','potter','STANDARD',to_date('06-MAY-09','DD-MON-RR'),21926,2809,null,null,null,null,null,null,null,'Ms.',null,null);
Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (108510,1,4557,91503,2809,to_date('05-MAY-09','DD-MON-RR'),to_date('06-MAY-09','DD-MON-RR'),'Verified',to_date('07-MAY-09','DD-MON-RR'),'Casper',null,'BOB','Jolene','Luna',null,'PO Box 146',null,'Boo','OK','74840','potter','STANDARD',to_date('01-MAY-09','DD-MON-RR'),21316,2809,null,null,null,null,null,null,null,'Ms.',null,null);
Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (101463,1,4557,88052,2809,to_date('05-FEB-09','DD-MON-RR'),null,'Mailed',to_date('05-FEB-09','DD-MON-RR'),'Boo',null,'BOB','Jolene','Luna',null,'PO Box 146',null,'Boo','OK','74840','potter','STANDARD',to_date('15-DEC-08','DD-MON-RR'),20525,2809,null,null,null,null,null,null,null,'Ms.',null,null);
Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (97272,1,4557,88052,2809,to_date('05-DEC-08','DD-MON-RR'),to_date('15-DEC-08','DD-MON-RR'),'Verified',to_date('17-DEC-08','DD-MON-RR'),'Casper',null,'BOB','Jolene','Luna',null,'PO Box 146',null,'Boo','OK','74840','potter','STANDARD',to_date('12-NOV-08','DD-MON-RR'),20018,2809,null,null,null,null,null,null,null,'Ms.',null,null);
Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (68398,1,4557,76399,1070,to_date('10-OCT-07','DD-MON-RR'),to_date('15-NOV-07','DD-MON-RR'),'Letter Returned',to_date('15-NOV-07','DD-MON-RR'),'KERRYMIN','post office: not delivaerable as addressed ','BOB','Jolene','Luna',null,'752 Boo',null,'Norman','OK','73072','Cleveland','STANDARD',to_date('17-MAY-07','DD-MON-RR'),16596,1070,null,null,null,null,null,null,null,'Ms.',null,null);
Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (63767,1,4557,76399,1070,to_date('09-AUG-07','DD-MON-RR'),to_date('20-AUG-07','DD-MON-RR'),'Letter Returned',to_date('20-AUG-07','DD-MON-RR'),'KERRYMIN','post office: not deliverable as addressed ','BOB','Jolene','Luna',null,'752 Boo',null,'Norman','OK','73072','Cleveland','STANDARD',to_date('17-MAY-07','DD-MON-RR'),16077,1070,null,null,null,null,null,null,null,'Ms.',null,null);
Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (59499,1,4557,76399,1070,to_date('14-MAY-07','DD-MON-RR'),to_date('17-MAY-07','DD-MON-RR'),'Verified',to_date('17-MAY-07','DD-MON-RR'),'LAWANHAM',null,'BOB','Jolene','Luna',null,'752 Boo',null,'Norman','OK','73072','Cleveland','STANDARD',to_date('14-MAY-07','DD-MON-RR'),15569,1070,null,null,null,null,null,null,null,'Ms.',null,null);
Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (54783,1,4557,74693,1070,to_date('01-MAR-07','DD-MON-RR'),to_date('06-MAR-07','DD-MON-RR'),'Verified',to_date('13-MAR-07','DD-MON-RR'),'Boo',null,'BOB','Jolene','Luna',null,'1203 Rebecca Lane',null,'Norman','OK','73072','Cleveland','STANDARD',to_date('01-MAR-07','DD-MON-RR'),14994,1070,null,null,null,null,null,null,null,'Ms.',null,null);
Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (34100,1,4557,58761,1094,to_date('08-FEB-06','DD-MON-RR'),null,'Mailed',to_date('31-MAR-06','DD-MON-RR'),'LAWANHAM','per M. Splawn','BOB','Jolene','Luna',null,'Rt. 1 Box 42',null,'Wewoka','OK','74884','Seminole','STANDARD',to_date('03-FEB-06','DD-MON-RR'),9560,1094,null,null,null,null,null,null,null,'Ms.',null,null);
Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (27562,1,4557,52781,1115,to_date('08-NOV-05','DD-MON-RR'),null,'Mailed',to_date('08-NOV-05','DD-MON-RR'),'Boo',null,'BOB','Jolene','Luna',null,'5590 Rebel Ridge Rd',null,'El Reno','OK','73036','Canadian','STANDARD',to_date('16-OCT-05','DD-MON-RR'),8034,1115,null,null,null,null,null,null,null,'Ms.',null,null);
Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (11822,1,4557,39238,1094,to_date('03-MAR-05','DD-MON-RR'),null,'Mailed',to_date('03-MAR-05','DD-MON-RR'),'Boo',null,'BOB','Jolene','Luna',null,'Rt. 1, Box 42',null,'Wewoka','OK','74884','Seminole','STANDARD',to_date('17-FEB-05','DD-MON-RR'),306,null,null,null,null,null,null,null,null,'Ms.',null,null);
Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (2257,1,4557,18958,1087,to_date('03-AUG-04','DD-MON-RR'),null,'Mailed',to_date('29-JAN-05','DD-MON-RR'),'SYSTEM',null,'BOB','Jolene','Luna',null,'1037 Tabor Drive',null,'Oklahoma City','OK','73107','Oklahoma',null,null,178,null,null,null,null,null,null,null,null,null,null,null);
I want to find the all the records whose mail date(earliest of all with no reply) and no response date and find the earlier one with reponse date and display it as a one row.
For example 
mail_Date+45 mail_Date in table    earliest date of reponse
BEGIN_DATE   DEL_DATES           END_DATE                 TRACKING_ID
17-SEP-04    03-AUG-04 06-          MAR-07                                2257
Other date and their response date should be shown same way
The issue is I am not able to retrieve other records in the tables because I am using MIN function.
here is my query
SELECT   t.MAIL_DATE + 45 begin_Date,
  del_date.del_dates,
  (SELECT MIN(st2.RESPONSE_DATE) Del_end_date
  FROM sor_tracking st2
  WHERE t.OFFENDER_ID   = st2.OFFENDER_ID
  AND st2.RESPONSE_DATE > del_date.del_dates
  ) End_date,
  t.OFFENDER_ID,
  t.TRACKING_ID
FROM
  (SELECT MIN(st1.MAIL_DATE) del_dates
    FROM sor_tracking st1
  WHERE st1.OFFENDER_ID  = 4557
  AND st1.RESPONSE_DATE IS NULL
  AND st1.MAIL_DATE      < SysDate - 45
  AND st1.STATUS                  IN ('Letter Returned', 'Mailed')
  AND st1.LETTER_ID               IN (1, 4)
  ) del_date,
  sor_tracking t
WHERE t.MAIL_DATE   <= del_date.del_dates
AND (t.OFFENDER_ID   = 4557
     AND t.RESPONSE_DATE IS NULL)
ORDER BY 1 desc
Thanks for you time and help.

with
sor_tracking as
(select 4557 offender_id,
        1 letter_id,
        to_date('05-NOV-13','dd-MON-yy') mail_date,
        781410 tracking_id,
        110207 location_id,
        null response_date,
        'Mailed' status
   from dual
union all
select 4557,1,to_date('08-FEB-12','dd-MON-yy'),190294,110207,to_date('15-FEB-12','dd-MON-yy'),'Verified' from dual union all
select 4557,1,to_date('05-DEC-11','dd-MON-yy'),184647,110207,to_date('13-DEC-11','dd-MON-yy'),'Verified' from dual union all
select 4557,1,to_date('03-FEB-11','dd-MON-yy'),157253,102288,null,'Mailed' from dual union all
select 4557,1,to_date('01-NOV-10','dd-MON-yy'),149710,102288,to_date('08-NOV-10','dd-MON-yy'),'Verified' from dual union all
select 4557,1,to_date('03-JUN-10','dd-MON-yy'),138268,99564,to_date('17-JUN-10','dd-MON-yy'),'Letter Returned' from dual union all
select 4557,1,to_date('04-FEB-10','dd-MON-yy'),128798,91503,null,'Mailed' from dual union all
select 4557,1,to_date('07-AUG-09','dd-MON-yy'),115073,91503,to_date('10-NOV-09','dd-MON-yy'),'Verified' from dual union all
select 4557,1,to_date('05-MAY-09','dd-MON-yy'),108510,91503,to_date('06-MAY-09','dd-MON-yy'),'Verified' from dual union all
select 4557,1,to_date('05-FEB-09','dd-MON-yy'),101463,88052,null,'Mailed' from dual union all
select 4557,1,to_date('05-DEC-08','dd-MON-yy'),97272,88052,to_date('15-DEC-08','dd-MON-yy'),'Verified' from dual union all
select 4557,1,to_date('10-OCT-07','dd-MON-yy'),68398,76399,to_date('15-NOV-07','dd-MON-yy'),'Letter Returned' from dual union all
select 4557,1,to_date('09-AUG-07','dd-MON-yy'),63767,76399,to_date('20-AUG-07','dd-MON-yy'),'Letter Returned' from dual union all
select 4557,1,to_date('14-MAY-07','dd-MON-yy'),59499,76399,to_date('17-MAY-07','dd-MON-yy'),'Verified' from dual union all
select 4557,1,to_date('01-MAR-07','dd-MON-yy'),54783,74693,to_date('06-MAR-07','dd-MON-yy'),'Verified' from dual union all
select 4557,1,to_date('08-FEB-06','dd-MON-yy'),34100,58761,null,'Mailed' from dual union all
select 4557,1,to_date('08-NOV-05','dd-MON-yy'),27562,52781,null,'Mailed' from dual union all
select 4557,1,to_date('03-MAR-05','dd-MON-yy'),11822,39238,null,'Mailed' from dual union all
select 4557,1,to_date('03-AUG-04','dd-MON-yy'),2257,18958,null,'Mailed' from dual
select offender_id,
       letter_id,
       to_char(event_date,'dd-MON-yy') mail_date,
       tracking_id,
       location_id,
       case when last_response_verified is null
            then status
       end status,
       to_char(last_response_verified,'dd-MON-yy') response_date,
       case when last_response_verified is not null
            then 'Verified'
       end response_status
  from (select offender_id,
               letter_id,
               event_date,
               tracking_id,
               location_id,
               status,
               to_find,
               verified_response,
               last_value(verified_response ignore nulls) over (partition by offender_id,letter_id
                                                                    order by event_date desc
                                                               ) last_response_verified
          from (select offender_id,
                       letter_id,
                       event_date,
                       tracking_id,
                       location_id,
                       status,
                       case when event_date < lead(event_date) over (partition by offender_id,letter_id,tracking_id
                                                                         order by event_date
                                                                    ) - 45
                            then 'THIS'
                            when status = 'Mailed'
                             and lead(tracking_id) over (partition by offender_id,letter_id,tracking_id
                                                             order by event_date
                                                        ) is null
                             and direction != lag(direction,1,'null') over (partition by offender_id,letter_id
                                                                                order by event_date
                            then 'this'
                       end to_find,
                       case when status = 'Verified'
                            then event_date
                       end verified_response
                  from (select offender_id,
                               letter_id,
                               mail_date event_date,
                               tracking_id,
                               location_id,
                               'Mailed' status,
                               'sent' direction
                          from sor_tracking
                        union all
                        select offender_id,
                               letter_id,
                               response_date,
                               tracking_id,
                               location_id,
                               status,
                               'rcvd' direction
                          from sor_tracking
                         where response_date is not null
where to_find is not null
order by event_date desc
OFFENDER_ID
LETTER_ID
MAIL_DATE
TRACKING_ID
LOCATION_ID
STATUS
RESPONSE_DATE
RESPONSE_STATUS
4557
1
05-NOV-13
781410
110207
Mailed
4557
1
03-FEB-11
157253
102288
13-DEC-11
Verified
4557
1
04-FEB-10
128798
91503
08-NOV-10
Verified
4557
1
07-AUG-09
115073
91503
10-NOV-09
Verified
4557
1
05-FEB-09
101463
88052
06-MAY-09
Verified
4557
1
03-AUG-04
2257
18958
06-MAR-07
Verified
Regards
Etbin

Similar Messages

  • To implement search help for date and time fields details

    how can i implement search help for date and time fields in screen painter

    Hi
    Declare the variables as sy-datum and sy-uzeit or any other pre-defined data typ of date and ime types. Serach help will automatically comes.
    Aditya

  • Help about Date and Time by CMP entity bean

    I should have two fields in my cmp .one stores current date ,another one stores current time while ejbcreate();
    I should be able to get findmethod findobjectBetween ?! and ?2
    or that sorts of find method.what type of the method should I use.
    java.util.Date or Simply String?
    if I use java.tuil.Date as the type.
    How shoud my ejbcreate method look like?
    public abstract void setDate(Date mydate);
    public abstract Date getDate();
    ejbCreate(String name,String password,Date mydate,Date mytime)
    setDate()
    I suppose I use write a business method getCurrentDate() which uses
    java.util.Date().toLocale,But I think it just returns String
    help pls.

    I am using oc4j(Oracle9iAS (9.0.3.0.0))
    I am getting the following error using Timestamp while deploying cmp entity bean ejb1.1. Thanks...
    Auto-deploying TimestampTestEntity.jar (No previous deployment found)... TimestampTest_EntityBeanWrapper0.java:1558: Missing term.
    if (if(thread.contextContainer != null)
    ^
    TimestampTest_EntityBeanWrapper0.java:1558: ')' expected.
    if (if(thread.contextContainer != null)
    ^
    TimestampTest_EntityBeanWrapper0.java:1559: Invalid expression statement.
    response != null) {if(thread.contextContainer != null)
             ^
    TimestampTest_EntityBeanWrapper0.java:1559: ';' expected.
    response != null) {if(thread.contextContainer != null)
                    ^
    TimestampTest_EntityBeanWrapper0.java:1560: Missing term.
    response.setNanos(if(thread.contextContainer != null)
                      ^
    TimestampTest_EntityBeanWrapper0.java:1560: ')' expected.
    response.setNanos(if(thread.contextContainer != null)
                      ^
    TimestampTest_EntityBeanWrapper0.java:1561: ';' expected.
    response.getNanos());} // generated from BeanMethodCompilation
    ^
    7 errors
    Error compiling F:\oc4j\j2ee\home\applications\TimestampAppl/TimestampTestEntity.jar: Syntax error in source
    Oracle9iAS (9.0.3.0.0) Containers for J2EE initialized

  • Query with Start Date and End Date

    Dear Members,
    I have done a basic query on to get a report on Sales Invoices processed in a given period with the General Ledger account they were posted to. Minor hassle is that to change the dates, I have to go into the script (see extract below) and change dates manually, save query etc.
    Is there a way to have the query, when selected to run, pop up with window, allowing user to input say "start date" and "finish date". I imagine it will require some complex addition to the script below, any assistance will be appreciated.
    Regards
    Raj
    SELECT T1.[DocNum] AS 'Document Number', T1.[DocDate] AS 'Posting Date', T0.[AcctCode] AS 'Account Code', T0.[Dscription] AS 'Item/Service Description', T0.[LineTotal] AS 'Row Total' FROM  [dbo].[INV1] T0  INNER  JOIN [dbo].[OINV] T1  ON  T1.[DocEntry] = T0.[DocEntry]   WHERE T1.[DocDate] > (CONVERT(DATETIME, '20110801', 112) )  AND  T1.[DocDate] < (CONVERT(DATETIME, '20110831', 112) )

    Hi Raj,
    try this:
    /*SELECT FROM [dbo].[OINV] T0*/
    declare  @StartDate as datetime
    /* WHERE */
    set @StartDate = /* T0.DocDate */ '[%0]'
    /*SELECT FROM [dbo].[OINV] T1*/
    declare  @EndDate as datetime
    /* WHERE */
    set @EndDate = /* T0.DocDate */ '[%1]'
    SELECT T1.DocNum AS 'Document Number', T1.DocDate AS 'Posting Date', T0.AcctCode AS 'Account Code', T0.Dscription AS 'Item/Service Description', T0.LineTotal AS 'Row Total'
    FROM dbo.INV1 T0 INNER JOIN dbo.OINV T1 ON T1.DocEntry = T0.DocEntry WHERE T1.DocDate > @StartDate AND T1.DocDate < @EndDate
    Thanks,
    Neetu

  • Help on Date and Time

    How come everytime I plug in my iPod onto the computer, my Date and Time Settings on my iPod always reset to a random date and time?

    Having same problem on two different iPods with two different computers here since last update. Am having to manually change date and time after each sync (very annoying) am hoping it will be fixed soon.Both computers are set with correct date and time and iPods are both reverting back to a date in October (I think)

  • CAML Query help using recursiveall and date filter together

    Hello,
    Please let me know what is wrong with the query below,
    <View Scope='RecursiveAll'>
    <Query>
    <Where>
    <Leq>
    <FieldRef Name='Modified'/>
    <Value Type='DateTime' IncludeTimeValue='FALSE'>date value</Value>
    </Leq>
    </Where>
    </Query>
    </View>
    Above query returns zero items, it should return 3 items in my current scenario.
    If I do just the folllowing, three items are returned
    <View Scope='RecursiveAll'>
    <Query>
    </Query>
    </View>
    I need date filter to work with recursiveall . Not sure what is wrong with the query
    Student For Life

    Hi,
    Per my understanding, you might want to use “RecursiveAll” with date filter in your CAML query statement.
    I suggest you take the code demo below which writes in Server Object Model for a try in your environment to see if it can work for you:
    using (SPSite oSiteCollection = new SPSite("http://yoursite"))
    using (SPWeb web = oSiteCollection.RootWeb)
    SPList list = web.Lists["List1"];
    SPQuery qry = new SPQuery();
    qry.Query =
    @" <Where>
    <And>
    <Leq>
    <FieldRef Name='Modified' />
    <Value Type='DateTime'>2015-03-07T12:00:00Z</Value>
    </Leq>
    <Eq>
    <FieldRef Name='FSObjType' />
    <Value Type='Integer'>0</Value>
    </Eq>
    </And>
    </Where>";
    qry.ViewFields = @"<FieldRef Name='Title' />";
    qry.ViewAttributes = "Scope='RecursiveAll'";
    SPListItemCollection items = list.GetItems(qry);
    foreach (SPListItem item in items)
    Console.WriteLine(item["Title"]);
    Thanks
    Patrick Liang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Help with JSP and logic:iterate

    I have some queries hope someone can help me.
    I have a jsp page call request.jsp:
    ====================================
    <%@ page import="java.util.*" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <html>
    <body>
       <%@ page import="RequestData" %>
       <jsp:useBean id="RD" class="RequestData" />
       <%Iterator data = (Iterator)request.getAttribute("Data");%>
       <logic:iterate id="element" name="RD" collection="<%=data%>">
          <jsp:getProperty name="RD" property="requestID" />
          <%=element%><br>
       </logic:iterate>
    </body>
    </html>
    And I have the RequestData.java file:
    ======================================
    private int requestID = 1234;
    public int getRequestID() { return requestID; }
    The jsp page display:
    ======================
    0 RequestData@590510
    0 RequestData@5b6d00
    0 RequestData@514f7f
    0 RequestData@3a5a9c
    0 RequestData@12d7ae
    0 RequestData@e1666
    Seems like the requestID is not returned. Does anybody know this?
    I have done the exact one using JSP and servlets, trying to learn using JSP and custom tags. The one with JSP and servlet looks like:
    ============================================
    <%@ page import="RequestData" %>
    <%Iterator data = (Iterator)request.getAttribute("Data");
    while (data.hasNext()) {
       RequestData RD = (RequestData)data.next();
       out.println(RD.getRequestID() );
    }%>

    Oh think I got it...
    but one thing I'm not sure is...
    If I use "<jsp:useBean id="RD" class="RequestData" />", do I still need "<%@ page import="RequestData" %>"?
    I tried without and it gives me error...

  • Need help with date and time calculations please

    Hello there.. Im stuck, and im hoping someone can help..
    Working on a list to manage and track PTO.  User completes PTO request form,
    Fields
    Name
    Start Date (with time)
    End Date (with time)
    Total Number of Days/hours requested: (calculation)
    Full Day: (Yes/No)
    ok business need
    user has the ability to request a certain number of hours as opposed to a full day.
    After searching around on google. I found this calculation to help me figure out how many BUSINESS days being requested.
    =IF(ISERROR(DATEDIF([Start Date],[End Date],"d")),"",(DATEDIF([Start Date],[End Date],"d"))+1-INT(DATEDIF([Start Date],[End Date],"d")/7)*2-IF((WEEKDAY([End Date])-WEEKDAY([Start Date]))<0,2,0)-IF(OR(AND(WEEKDAY([End
    Date])=7,WEEKDAY([Start Date])=7),AND(WEEKDAY([End Date])=1,WEEKDAY([Start Date])=1)),1,0)-IF(AND(WEEKDAY([Start Date])=1,(WEEKDAY([End Date])-WEEKDAY([Start Date]))>0),1,0)-IF(AND(NOT(WEEKDAY([Start Date])=7),WEEKDAY([End Date])=7),1,0))
    This works great as long as its a [Full Day]="YES", displays results in column labeled Number of days
    now if [Full Day]="No", displays results in column labeled Number of Hours
    BUT this is my issue (well part of it) it calcuate the correct number of hours.. but puts a "1" in "Number of Days" why.. dates have not changed.. I think Its something with the above calculation but I could be way off.
    the end result is I need number of days to concat with number of hours 
    i.e 1 full day 4 hours  1.4
        0 full day 5 hours  0.5
        1 full day 0 hours  1.0
    so that the total can be deducted via workflow.. from the remaining balance in a tracker. (seperate list) 
    Any angels out there??

    Posnera-
    Try changing time zones and see if the travel itinerary times change.
    Fred

  • Urgent Help with Date and then email in ASP

    Hii,
    USING ASP AND ACCESS
    I am implementing a classified section for my website and I
    am displaying
    everything successfully.
    When the user posts the classified he selects how many days
    he wants his
    POST like 10 days, 20 days or 30 days and i can successfully
    show the posts
    So if the user posts on says 1st of July 2006 and selects 10
    days for his
    post to be showed on my website
    THEN
    8th July 2006 an email shud go to him saying if he wants to
    keep his POST
    for another 10 days, 20 days or 30 days with 3 links
    and IF YES the 1st july 2006 date must be changed to
    Date of Post + Number of days selected initially + Number of
    days selected.
    I am using two columsn in the DB for this date thing one is
    the strPostDate
    and strAddDate
    So basically the number of days selected for the post to be
    shown on the
    website keeps adding up each time the user clicks on the link
    for 10 days,
    20 days or 30 days with 3 links
    please help need it badly :-)

    I have to disagree with my colleages above - this isn't that
    hard at all. I have done it a number of times successfully. It does
    depend on a "trick", but who cares as long as it works.
    Basically, the "trick" says that your site will receive a
    visit once in a while! It better, or why have the site!
    In ASP, use the global.asa file. In the "Session start"
    section of global.asa, which is fired off every time a new comer
    arrives, you have an opportunity to:
    1. check if it's ok to check who needs an email (in other
    words, you don't want to be checking EVERY time someone comines on
    board every last listing on your site. So what i would do is allow
    it to do the full check once daily, say after midnight.
    2. If its ok to check who needs an email, do so, and send the
    emails out.
    3. After sending out emails, fix it so you will not be
    resending uptil teh next time window. You could also set "flags"
    for any lister where you sent an email 1st round email has been
    sent.
    The above is one way.
    Sometimes i do the very same thing, but i simply tie the
    checking routine into the home page.
    Both schemes work as long as you have a single visitor once
    in a while. if you never had a visitor to teh site, not even one,
    then the emails would never be sent. But as i said if you go days
    without a visit, better start looking for a new vocation!
    www.brunswickdowntown.com is a site i did that has a
    sign-up-to-stay informed email system, its been running for a year
    just fine, all automatically, using the method of #1 (but for
    asp.net, same difference!)
    Rick

  • BEx query: CO-PA data and hierarchy

    Hi BEx fans
    We need to design a report in BEx.
    There is a hierarchy in play, with let us say 2 levels. 2 Key figures are determined.
    Hierarchy Level 1
    Hierarchy Level 2
    Key figure 1
    Key figure 2
    Commercial Business
    150
    150
    Mix0
    100
    50
    Mix1
    50
    100
    Non Commercial Business
    100
    100
    Mix1
    100
    100
    Regarding the key figures let us explain it more detailled, they are designed depending on hierachy level values:
    Key figure 1 should be be restricted by Mix0 and Mix1 (hierarchy level 2). On the other way it should also be restricted on Mix1 (level 2).
    I have defined a query which doubles the keyfigures, instead of 2 there are at all 4 keyfigures. Executing the query you will see the 4 keyfigures correctly in a line (row area).
    If you add the charateristic with collapsed hierarchy you will also see the these key figures correctly, but if you extract the hierarchy level from 1 to 2, you will recognize that the doubled keyfigures will be shown (with no values -> correct).
    Question: Do you know a way how to eliminate these "duplicate" key figure rows when using the hierarchy? Is there another way to solve this problem?
    Thanks
    T.

    Hi Yiannis
    I have created a second charateristic which determines the logic of level 2 from the hierarchy characteristic (characteristic no. 1).
    Then I additionally restricted the key figures with the relevant values of character no 2.
    Unfortunately it doesn't work, still the same effect.
    This is strange, as it is not really logic.
    In the screen you can see KFG1 and KFG2, next column the new characteristic.
    KFG1 is restricted additonally on value 1 of this new characteristic.
    As you can see, the values 2, 3 and 4 are still displayed.
    Do you know the reason for this?
    Thanks
    T.

  • Sales order query - display invoice date and invoice number

    I have a query that is reading information from both the ORDR and RDR1. How do I link to AR invoice to get the invoice number and invoice date if the line item of the sales order has been shipped (we do not use deliveries so the AR invoice is the next document after the sales order.
    Thanks

    Hi Keith,
    The link between ORDR and RDR1 to invoice:
    RDR1.trgetentry = OINV.DocEntry
    or
    INV1.BaseEntry = ORDR.DocEntry
    Use which is more appropriate to your query
    Regards,
    David

  • SQ01 Query Help for (MKPF and MSEG)

    Is their anyway to have the field MSEG-ERFMG show up on the query results as postive or negative color or use a "-" or "+".  Need to try and show whether is was a negative or postive movement.

    F1 help for MSEG-SHKZG
    Debit/credit indicator in revaluation
    This indicator is used for internal program control.
    Please do not change the entry in this field.
    Any changes made could lead to program errors or terminations.
    I guess the "sign" is defined trough this field ("S" - sollen (debit), "H" - haben (credit)). If my assumption is true, you won't be able to see + / - in MSEG-ERFMG simply because this field contains no information on the sign.
    Using ABAP code you can solve it (or in SQ01 you can use calculated field in your query...I'm not sure you can define that calculated field to cover your requirement...).
    Regards,
    Csaba
    Edited by: Csaba Szommer on May 12, 2009 11:20 PM

  • HELP PLS ITUNES AND QUICKTIME STOPPED WORKING

    the details are:
    Problem signature:
      Problem Event Name:          APPCRASH
      Application Name:          iTunes.exe
      Application Version:          10.3.1.55
      Application Timestamp:          4deec351
      Fault Module Name:          ntdll.dll
      Fault Module Version:          6.1.7600.16695
      Fault Module Timestamp:          4cc7ab86
      Exception Code:          c0000005
      Exception Offset:          00038db9
      OS Version:          6.1.7600.2.0.0.768.3
      Locale ID:          1033
      Additional Information 1:          0a9e
      Additional Information 2:          0a9e372d3b4ad19135b953a78882e789
      Additional Information 3:          0a9e
      Additional Information 4:          0a9e372d3b4ad19135b953a78882e789
    Read our privacy statement online:
      http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
    If the online privacy statement is not available, please read our privacy statement offline:
      C:\Windows\system32\en-US\erofflps.txt
    PS: I have the latest itunes and quicktime and I tried reinstalling and installing it again but it won't work. PS I have an iphone 4

    Fault Module Name:          ntdll.dll
      Fault Module Version:          6.1.7600.16695
    Are the problem reports for the QuickTime Player launch errors also citing ntdll.dll, jk?

  • Handling DATE and TIME in SELECT Statment

    Hey pros,
    I have this problem where I want to execute a select query based on date and time, but I want it to be handled in such a way which is better explained with this example:
    User enters a date range of Apr. 10 and Apr. 12
    User enters a time range of 9:00am - 10:00am
    The results I want would be from April 10 9:00am to Apr. 12 10am.
    The way I have it working today is that it shows me all data from Apr. 10-12 from 9am-10am on all days.
    Is there an easy way to do this?
    Here is my code (see the 3rd last and 2nd last line)  Thanks!
    SELECT vepowerks vepolgort vepo~matnr
              mara~mtart
              vepovenum vepovepos
              vekperdat vekperuhr vekpstatus vekpexidv
              "gc_bwart as bwart
              vepovemng vepovemeh
              vepo/cwm/vemng vepo/cwm/vemeh
        INTO CORRESPONDING FIELDS OF TABLE gt_tran
    INTO CORRESPONDING FIELDS OF TABLE itab
        FROM vepo
          INNER JOIN vekp ON
              vepovenum = vekpvenum
          INNER JOIN mara ON
              vepomatnr = maramatnr
        WHERE
              vepo~werks = p_werks    AND
              vepo~lgort IN s_lgort   AND
              vepo~matnr IN s_matnr   AND
              vepo~bestq = gc_bestq   AND
              NOT ( vepovemng = 0 AND vepo/cwm/vemng = 0 ) AND
              vekp~status = gc_status AND
              vekp~erdat IN s_erdat   AND
              vekp~eruhr IN s_eruhr   AND
              mara~mtart IN s_mtart.

    I think you might just have to select the date range, then do a loop and read table.
    select xx where date in date_range from x into table y.
    loop at y into wa_y.
      if wa_y-date = lower_date_limit. "this day has the 9am limit
        "only pick those records that have wa_y-time GE 9am.
        <your logic here>
      elseif wa_y-date = upper_date_limit. "this day has teh 12pm limit
        "only pick those records that have wa_y-time LE 12pm.
        <your logic here>
      else. "every day in between the dates
        "get all data no matter what the time is
        <your logic here>
      endif.
    I honestly don't know if there is a select-where clause that will do this automatically, but the above solution should work..hope this helps.
    --Juan
    Edited by: takeabyte on Apr 29, 2010 8:36 PM

  • DATE and TIME and PATH stamps

    I'm a relative newbie still having issues with getting date and time stamps on my printed documents. I use Preview, Pages, Numbers and also tend to print to PDF a lot, which I am opening in Preview.
    I have found an "Insert" ability in Pages but for some reason it appears to only give me the date that I inserted the Timestamp and despite thinking that I understood that this would update itself when I re-open the document it does not seem to be doing this.
    Can anyone help me figure out what I am doing wrong and/or what my options in Mac for putting the following on a document:
    A. DATE and TIME /printed/
    B. NAME of document with LOCATION (I assume this is software specific?!)
    Thanks for any (further) help with this.
    - Jon

    menu Insert > Date_time
    then apply what was described by Jerrold in his message above
    Helpful AnswerRe: DATE and TIME and PATH stamps
    22 nov. 2011 18:05 (in response to hotwheels 22)
    Or simply double-click the inserted date-time (CAUTION : I don't know if the double click apply with every system or if it's dedicated to Lion).
    As far as I know, the inserted date behaves the same in header, footer, text box or main text layer.
    Yvan KOENIG (VALLAURIS, France)  mardi 22 janvier 2011 20:25:12
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

Maybe you are looking for

  • Interactive report performance problem over database link

    Hi gurus, I have an interactive report that retrieves values from two joined tables both placed on the same remote database. It takes 45 seconds to populate (refresh) a page after issuing a search. If I catch the actual select that is generated by ap

  • Ssrs 2008 r2 writingmode=rotate270 font is bold on report server

    In a ssrs 2008 r2 report, I am using writingmode=rotate270 to change the direction of header columns for detailed data on the SSRS report. The font in visual studio is 'light'. However when the report is deployed to the report server, the font weight

  • Problems in pdk and jpdk samples?

    Any known problems in the samples externalApp and iFame that comes with the latest PDK and JPDK? I tried to install these samples by following exactly the steps in the installation html files. But, when trying to test the installation in the last ste

  • RPM Measurement using Quadrature Encoder and PXI 6602 counter

    Hi, I am on a project at work where I need to verify the speed (in RPM) of an unloaded motor which can operate up to 1400 rpm.  After doing some research, i determined that a quadrature encoder could be used to make the measurement.  I am looking at

  • IBM OS ISSUE: SYSTEM HANG WITH JFS2 AND HEAVY LOAD

    제품 : ORACLE SERVER 작성날짜 : 2004-11-24 IBM OS ISSUE: SYSTEM HANG WITH JFS2 AND HEAVY LOAD ================================================== PURPOSE 이 문서는 IBM AIX5L OS 상에서 Arch Process가 online redo log 를 release하지 못하고 OS의 kill 명령으로 kill조차 되지 않을 경우 조치 방