Application Development 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: 

select statement

Former Member
0 Kudos

Hi all

I need to display all the records which are created between some time period...like ..

all the records created from 01-01-2005 morning 10 am to 01-02-2005 evening 5 o clock

how the select stament should be?

thanks in advance.

sai

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

You need to have the created date and time in the table.

Then

SELECT * from table

where create_date between '01012005' and '01022005'

and create_time between '100000' and '170000'.

Regards,

Ravi

Note : Please mark the helpful answers

7 REPLIES 7

Former Member
0 Kudos

Hi,

You need to have the created date and time in the table.

Then

SELECT * from table

where create_date between '01012005' and '01022005'

and create_time between '100000' and '170000'.

Regards,

Ravi

Note : Please mark the helpful answers

0 Kudos

i dont think it will work. coz with this statement we can not select the record which is created on 02-01-2005 morning 8 o clock

got my point?

thanks

sai

0 Kudos

You are right .. in that case use this

SELECT * from table

where ( create_date = '01012005' and create_time > '100000' )

or ( create_Date = '01022005' and create_time < '170000' ).

Regards,

Ravi

Note : Please mark the helpful answers

Former Member
0 Kudos

Does the table have a create time and date? If not, are there change documents for the application that creates entries?

Rob

0 Kudos

Assuming you have both a create date and time, try:


Select * from whatever
  where ( create_date >  low_date   and
          create_date <  high_date) or
        ( create_date =  low_date   and 
          create_time >= low_time)  or
        ( create_date =  high_date  and 
          create_time <= high_time) .

Messy, but I think it's what you want.

Rob

Former Member
0 Kudos

Hi,

Could you come with what are the inputs do you have to proceed further.

Like from which table you are fetching and fields.

Any way look at the example......

SELECT f1 f2 f3 f4 from <DB Table> into table ITAB where

f1 = f1 and

date in s_date and

time in s_time.

Thanks.

0 Kudos

Checking the values like this will not work....

where date in s_date and
      time in s_time.

You need to check the date/time as one element, like a timestamp.

20060504101010

There is probably not a field like this in your table, so you will have to check it after the select.

Regards,

Rich Heilman