Jump to content

Probably a noob query question! Chosing date range.


Recommended Posts

So i need to pull data from a table and the query should go something like this.

 

SELECT * FROM tablename WHERE Date is between 01-JUN-09 to 18-Jun-09

 

How do i write the bold part... im not sure how the range thing works.

 

Thanks.

 

Your date field has to be either type 'date' or 'timestamp'.  It can't be a varchar.

And the BETWEEN ... AND ... syntax http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#operator_between does not use the words "is" and "to" (I know you were asking in pseudo code, but the documentation exists for a reason - so that you can research the basics yourself.)

 

Edit: mysql forum questions get mysql answers.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.