Results 1 to 3 of 3

Thread: dates

  1. #1
    Join Date
    Dec 1969

    Default dates

    i have a field in access that contains a date in the format 01/29/2000. i would like to select distinct values based only on the year portion. can this be done in sql or do i have to handle it in ASP?

  2. #2
    PrasannkumarNadella Guest

    Default RE: dates

    Use DATEPART("YY",date) function in sql.

  3. #3
    J. Paul Schmidt Guest

    Default The Years Seem to Just Fly By

    You have a date field and want to show all records within one or more years.<BR><BR>Well you COULD possibly add a calculated field in the SQL for just the year and then use that for your BETWEEN portion of SQL. But that can be SLOW as a calculation has to be done FOR EVERY record in the table to determine which ones match.<BR><BR>I&#039;d suggest creating a BETWEEN portion of the SQL based on January 1 of the beginning year thru December 31 of the ending year.<BR><BR>"BETWEEN #" & DateSerial(MyBegYrVariable, 1, 1) & "# AND #" & DateSerial(MyEndYrVariable, 12, 31) & "#" ...<BR><BR>Best regards,<BR>-Paul<BR><BR>J. Paul Schmidt, MBA<BR>Databases on the Web<BR><BR>

Posting Permissions

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