How to write a MYSQL statement when the time field for intercepting a database in MYSQL is equal to the submitted value?

Source: Internet
Author: User
In MYSQL, when the database truncation time field is equal to the submitted value, how to write MYSQL statement bl_time is a field (for example, 11:33:20)
$ Year is the value submitted by the form (for example, 2014)

... Where YEAR ('ruku. bl_time ') = ". $ Year;

The Year in the bl_time field is equal to the value of $ Year in the form submission.
How can I write the statements after where?


Reply to discussion (solution)

$ SQL = "select * from table where year (bl_time) = '$ year '";

The year is intercepted.
What is the use of month and day?
Month (bl_time) and day (bl_time? I tried it. it seems no way.

It is okay to use month () and day (). Have you tried it.

After half a day, it turns out that the values in the submitted form have not been passed, so no wonder it doesn't work.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.