Select stmt not working

  • Hi all i m trying to retrieve data from a table which contains from date and

    to date fields but i am trying to retrieve data between certain date but its show only few records not the exact records

    the code is

    SELECT * FROM TIMETRACK WHERE LOGIN BETWEEN '02/11/10' AND '02/26/10

    its showing only 11th dated records

    but actually i have records up to 26th dated

    Please give me solutions

    Thanks in advance

    karthik

  • This is because you are not considering the time-part of the date. By default, a date without time is considered as 00:00:00.

    You either need to explicitly add the time-part in the where condition or convert the between clause to comparison clause and by adding a day to todate, i.e.

    SELECT * FROM TIMETRACK WHERE LOGIN BETWEEN '02/11/10 00:00:00' AND '02/26/10 23:59:59 999'

    SELECT * FROM TIMETRACK WHERE LOGIN >= '02/11/10' AND LOGIN < '02/27/10'

    --Ramesh


  • For clarity, I like to use the full year YYYY in my dates. It helps prevent any confusion.

  • Hi Ramesh,

    Its working fine now thanks for your help

    Regards

    Karthik

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply