If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > retrieve rows based on date

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-05-03, 17:11
ryland22 ryland22 is offline
Registered User
 
Join Date: Nov 2003
Posts: 2
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
Reply With Quote
  #2 (permalink)  
Old 11-05-03, 17:52
aus aus is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On