Skip to Content
avatar image
Former Member

select statement

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    May 04, 2006 at 04:06 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

  • avatar image
    Former Member
    May 04, 2006 at 04:07 PM

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

    Rob

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • avatar image
    Former Member
    May 04, 2006 at 04:07 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • 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