Jump to content

Search Help


lmhart

Recommended Posts

I have a database that stores record_date varchar(10) in the form of 2009/11/03. 

 

However I can not get it to return any data.

 

Also I am running the query in mysqladmin.

 

Will someone please advise what I am doing wrong.

 

Here is my query.

Select * from 'record' where record_date = 2009/11/03

Link to comment
Share on other sites

In general you should NOT store dates in VARCHAR(). There's DATE datatype for that. Doing so will also allow you for easy comapring dates, adding, substracting etc, while in VARCHAR it will be much more difficult and less effiicient.

 

In particular:

Select * from 'record' where record_date = '2009/11/03'

 

 

 

Link to comment
Share on other sites

Thanks. that works.

 

I agree with you but I can not figure out how to store a date with out using a varchar.  My info is being input after the fact and some can take up to two weeks to post.  I want it to reflect the date it occured not the date entered. So a time date stamp did not work.

Link to comment
Share on other sites

You can enter whatever date you wish into a datefield (within limits described in manual) and whenever you wish. You just need to remember that it's in YYYY-MM-DD format (you can use different separators, it's just the order that counts)

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.