hello,
I am trying to orderby 'title' which i have saved as a date. But the db actually has this field as a varchar type so it's saving as a string so it's not working like i want it to. So i am trying to find out - will mysql allow me to covert this string to date and then orderby? in other words is there a way i can temporarily convert this so it can be sorted this way?does that make sense??
thanks
ORDER BY STR_TO_DATE(title)
Although I have to wonder, why are you storing a date in a column called title? You column names should, for your benefit more than anyone else's, reflect the data which they contain.
thank you for the response! regarding your question: well, i have a date object which shows different types of things that are going on for that date. so i wanted the user to be able to find the article by it's date which would be easy if this is the title...and i wanted to sort by date (which i would get from the title) when displaying a list of articles.
The only reason why database columns have names is so that people can understand what is stored in them. Who benefits from calling a column that stores dates "title"?
Each article has details of what's going on - an actual schedule - for that specific date. Unless i am misunderstanding, I don't see why it would be an inappropriate title to label that article as "June 5," for example.. There are other columns where the date is actually a date (for example a date_created col, etc).