Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Posts
    2

    Unanswered: retrieve rows based on date

    I'm new to mysql and want to retrieve all rows from my dbase where my table column "registry_date" is the same month as variable "var_month".

    I tried using DATEPART function, but I received syntax errors. My sql statement was:

    SELECT * FROM corporate_table WHERE DATEPART(mm, registry_date)=var_month

    Came someone point me in the right direction? Much thanks,
    Mike

  2. #2
    Join Date
    Oct 2003
    Location
    Denver, Colorado
    Posts
    137
    When you use user variables you need to specify them using the '@' symbol.
    i.e.
    @var_month

Posting Permissions

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