Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Select statement with date & time period

arindam_samanta
Participant
0 Likes
3,288

Hi Expert,

I want fetch data from  LTBK table based date and time period like from 10.12.2003 04:30:12 to 11.12.2003 14:12:20. I have written one select statement. But its not working. My statement is below:

SELECT  lgnum  " Warehouse Number
              tbnum  " Transfer requirement number
             bwlvs  " Movement Type for Warehouse Management
             benum  " Requirement number
             betyp  " Requirement Type
             pdatu  " Date of Planned Execution of Transfer Request
             pzeit  " Time of Planned Execution of Transfer Requirement
             tbpri  " Transfer Priority
             lznum  " Additional number
       FROM  ltbk INTO TABLE t_ltbk
       WHERE lgnum EQ p_lgnum                  
       AND   ( pdatu >= p_pdatu  AND pzeit >= p_pzeit )
       AND   ( pdatu <= p_todate AND pzeit <= p_totime ).

I checked, due to date and time period condition its not working.

Kindly suggest to fetch data based on my date and time period condition.

Thanks in advance...

Thanks & regards,

Arindam Samanta.

Hi Expert,

I want fetch data from  LTBK table based date and time period like from 10.12.2003 04:30:12 to 11.12.2003 14:12:20. I have written one select statement. But its not working. My statement is below:

SELECT  lgnum  " Warehouse Number
              tbnum  " Transfer requirement number
             bwlvs  " Movement Type for Warehouse Management
             benum  " Requirement number
             betyp  " Requirement Type
             pdatu  " Date of Planned Execution of Transfer Request
             pzeit  " Time of Planned Execution of Transfer Requirement
             tbpri  " Transfer Priority
             lznum  " Additional number
       FROM  ltbk INTO TABLE t_ltbk
       WHERE lgnum EQ p_lgnum                  
       AND   ( pdatu >= p_pdatu  AND pzeit >= p_pzeit )
       AND   ( pdatu <= p_todate AND pzeit <= p_totime ).

I checked, due to date and time period condition its not working.

Kindly suggest to fetch data based on my date and time period condition.

Thanks in advance...

Thanks & regards,

Arindam Samanta.

6 REPLIES 6
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,980

Replace with check like

( date GT date1 OR ( date EQ date1 AND time LE time 1 )

Same logic for high range ofdate+time.

Regards,
Raymond

Read only

0 Likes
1,980

Hi Raymond,

This is really a good logic when we have both date and time. I just wanted to confirm as i got a doubt in this.

date: the date he is trying to check.    time: the time he is trying to check.

date1: the from date.  time1: from time

date2: to date            time2: to time.

( date GT date1 OR ( date EQ date1 AND time LE time 1 )  

Here if date is greater that date1 off course no need to check time. But date is equal to date1 we need to check time and time should also be greater than or equal to time1 right for selecting the value. which is reverse in case of high value date2 and time2.

Please let me know if I am mistaken.

thanks a lot.

Aswath.

Read only

0 Likes
1,980

Yes you are right, was a typo, correct test is

( date GT date1 OR ( date EQ date1 AND time GE time1 ) ) AND ( date LT date2 OR ( date EQ date2 AND time LE time2 ) )

Regards,

Raymond

Read only

0 Likes
1,980

Thanks Raymond.....

Read only

arindam_samanta
Participant
0 Likes
1,980

Thanks both of you...Raymond's solution helps me really..

Read only

0 Likes
1,980

Hi........ If you have solved the problem please close the thread......

thanks.