Results 1 to 6 of 6

Thread: date + hour

  1. #1
    Join Date
    Oct 2004
    Posts
    27

    date + hour

    I want to get the count of id for a date and hour

    06/09/2004 09:19:00


    for the date = 06/09/2004
    i want the count of ID for the hour = 09


    for access 2000

    SELECT COUNT users.id WHERE users.dates = #06/09/2004# AND hour(users.dates) = #9#

    (i dont want to have to write the 0 of 09)

    it doesn't work

    with variable of course

    SELECT COUNT users.id WHERE users.dates = #[@date]# AND hour(users.dates) = #[@hour]#



    thank you

  2. #2
    Join Date
    Oct 2004
    Posts
    27
    i cannot get it

    nobody knows ?


    thanks a lot

  3. #3
    Join Date
    Feb 2003
    Posts
    1,048
    Have you tried it without the #'s around the hour? hour() should be returning an integer.

    hour(users.dates) = 9

  4. #4
    Join Date
    Oct 2004
    Posts
    27
    no i get nothing
    the only heavy way i get what i want is

    SELECT user.id,
    Year([inscription]) AS year,
    Month([inscription]) AS month,
    Day([inscription]) AS day,
    Hour([inscription]) AS hour
    FROM user
    WHERE (((Year([inscription]))=[@year])
    AND ((Month([inscription]))=[@month])
    AND ((Day([inscription]))=[@day])
    AND ((Hour([inscription]))=[@hour]));
    Last edited by gwendaal; 02-26-2005 at 05:03 AM.

  5. #5
    Join Date
    Feb 2003
    Posts
    1,048
    Those functions return integer values, so it should work if inscription = #06/09/2004 09:19:00# (assuming mm/dd/yyyy date format):

    SELECT user.id,
    Year([inscription]) AS year,
    Month([inscription]) AS month,
    Day([inscription]) AS day,
    Hour([inscription]) AS hour
    FROM user
    WHERE Year([inscription]) = 2004
    AND Month([inscription]) = 6
    AND Day([inscription]) = 9
    AND Hour([inscription]) = 9;

  6. #6
    Join Date
    Oct 2004
    Posts
    27
    yes that's my method and it works fine .... i am using 4 variable ...

    thank you

Posting Permissions

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