Mybatis queries the time period of mysql, and mybatis queries mysql

Source: Internet
Author: User

Mybatis queries the time period of mysql, and mybatis queries mysql

The mapper file is written as follows: (fuzzy query, query time range)

                <if test="com_name!=null and com_name!=''">and sc.com_name like CONCAT(CONCAT('%',#{com_name}),'%')</if><if test="check_begin_date!=null and check_begin_date!=''"><![CDATA[  and DATE_FORMAT(tcb.check_begin_date, '%Y-%m-%d') >=  DATE_FORMAT(#{check_begin_date}, '%Y-%m-%d')]]></if><if test="check_end_date!=null and check_end_date!=''"><![CDATA[  and DATE_FORMAT(tcb.check_begin_date, '%Y-%m-%d') <=  DATE_FORMAT(#{check_end_date}, '%Y-%m-%d')]]></if>



Mysql time period Query

Your request is between '2017-7-12 11:18:54 'and '2017-7-12 11:22:20 '.
Apparently, 11:18:46 and 11:22:22 are not between them. Why should they be included in the result set?
I also discuss the three upstairs
Select sum (csize) from table where cdtime between '2017-7-12 11:18:54 'and '2017-7-12 11:22:20'
--------------------------------------------
If there is another row in the table '2017-7-12 11:22:21 ', will the result set be 6 or 5?
This is clearly a problem with your description.
--------------------------------------------
Sorry, please give a clearer description
That is, if your nested query is used, the result set will be 5, not 6.

Is Mybatis the same as Mysql query statements?

Yes, yes.
You need to understand a concept. The statement we use when querying relational databases is SQL, which is the industrial standard supported by most relational database management systems, therefore, whether we query Mysql, Oracle, or other databases, it is the same SQL, whether it is java or C #.

Related Article

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.