Results 1 to 5 of 5

Thread: This is unusual

  1. #1

    Thread Starter
    Hyperactive Member Janaka's Avatar
    Join Date
    Nov 2001
    Posts
    277

    Question This is unusual

    VB Code:
    1. SELECT A.referenceno,  B.datetime
    2. FROM defectiveitem AS A, exportorder AS B, customer AS C
    3. WHERE A.exportorderid = B.id AND A.customerid = C.id AND C.name = 'SLT'
    4. AND
    5. (B.datetime >= '20/04/2001' AND B.datetime <= '21/04/2001')
    6. ORDER BY B.id

    When I run this query I don’t get the dates that are equal to '21/04/2001' even though there are data like that



    i am using sql server 2000

  2. #2
    Si_the_geek
    Guest
    you are using UK date format (dd/mm/yyyy), try using american format instead (mm/dd/yyyy), eg:

    Code:
    SELECT A.referenceno,  B.datetime
    FROM defectiveitem AS A, exportorder AS B, customer AS C 
    WHERE A.exportorderid = B.id AND A.customerid = C.id AND C.name = 'SLT' 
    AND 
    (B.datetime >= '04/20/2001' AND B.datetime <= '04/21/2001') 
    ORDER BY B.id

  3. #3

    Thread Starter
    Hyperactive Member Janaka's Avatar
    Join Date
    Nov 2001
    Posts
    277
    No Luck

  4. #4

    Thread Starter
    Hyperactive Member Janaka's Avatar
    Join Date
    Nov 2001
    Posts
    277
    i do get some of the dates 19,20 etc only 21 i don't get

  5. #5
    Si_the_geek
    Guest
    Ah!! just realised it is a date-time field!!

    when you don't specify a time it assumes midnight, so just set the parameters like this:

    (B.datetime >= '04/20/2001' AND B.datetime < '04/22/2001')

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width