Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7908371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:54:18+00:00 2026-06-03T11:54:18+00:00

I am having my date field in Mysql which is stored as char is

  • 0

I am having my date field in Mysql which is stored as char is as follows 050712.. Now I would like to display the results which are available in the database which are less than this date. I write as follows

Condition should fail

select * from tblFedACHRDFI where date_format(changedate,'%m/%d/%Y')> 05/08/12;

This is displaying all records which are available but I don’t need that I would like to display only when date is 05/06/12 which means

True Condition

select * from tblFedACHRDFI where date_format(changedate,'%m/%d/%Y')> 05/06/12;

The same worked for me in Sqlserver when I write as follows

Records not getting displayed which is true as per my requirement

select * from tblFedACHRDFI where
 CONVERT(datetime,(SUBSTRING(ChangeDate,1,2)+'/'
+SUBSTRING(ChangeDate,3,2)+'/'+dbo.Years
(SUBSTRING(ChangeDate,5,2))+SUBSTRING(ChangeDate,5,2)))>
 '05/08/2012'

So can any one help me where I went wrong in MySql statement..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T11:54:19+00:00Added an answer on June 3, 2026 at 11:54 am

    A MySQL date should be YYYY-MM-DD, column type should be DATE.

    If you wish to store a date any other way (for example, a CHAR(6) as you do here), you’ll have to use conversions each time you use the date. This is slower, uses more CPU, and can fail because you can store invalid values in your CHAR field.

    It does work, however. Use the STR_TO_DATE function to convert your CHAR column to a proper date. Now you can compare it against a proper date, use INTERVAL functions, the whole shebang:

    select * 
    from tblFedACHRDFI 
    where str_to_date(changedate,'%m%d%Y') > "2012-08-05";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an order table in MySQL database, having a field/column which stores the
Good morning, mysql query which displays cases that have a date field completed &
I have a table with a date field, having human date in it like:
I'm having trouble finding or figuring out how to output a MySQL date field
Having a date reference UserJoinDate and the list of dates List friendsJoined I would
Having code: Date::Date(const char* day, const char* month, const char* year):is_leap__(false) { my_day_ =
I'm having problems retrieving the time from a date field in a SP. If
Scenario: My PHP application will always use the date field DD-MM-YYYY. MySQL obviously always
I'm having a problem with a MySQL query which is too slow because the
I am having a issue with a date format issue. I am using mysql,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.