locked
Help with sql statement for access database RRS feed

  • Question

  • User-414004089 posted

    I have a members Access database and want to retrieve their date of birth if their birth month is the same as the current month.  I will then write that data to my web site. Something like this ...

     if getMonth(memberDoB) = (curdate.getMonth()+1) then

     response.write memFirst & " " & memLast

    end if

    My date and member DoB is in the format ddmmyyy and may cause problems since my ISP is in the US, but that's not imsurmountable.

     

    Monday, June 1, 2009 2:34 AM

Answers

  • User2138254679 posted

     Hi,

    you can write query as below

     
    select * from [tblMember] where datepart(mm,birthdate)=datepart(mm,getdate())

    I have all the member which has birthday in current month

    select * from [tblMember] where datepart(mm,birthdate)=datepart(mm,getdate()+1) 

    you can also add one if you want all member which has birthday in next month

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 1, 2009 4:50 AM

All replies

  • User2138254679 posted

     Hi,

    you can write query as below

     
    select * from [tblMember] where datepart(mm,birthdate)=datepart(mm,getdate())

    I have all the member which has birthday in current month

    select * from [tblMember] where datepart(mm,birthdate)=datepart(mm,getdate()+1) 

    you can also add one if you want all member which has birthday in next month

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 1, 2009 4:50 AM
  • User-414004089 posted

     Thanks a lot for that.

    Monday, June 1, 2009 6:08 AM