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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

The field is DATE type, and it contains info in this format  DD-MON-YY.

Bah im an idiot, i posted this on MySQL when it's an Oracle database LOLz.

But i guess there might be enough similarities for me to figure out once i know the MySQL query.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.