Requirement: Query ongoing activity data There are several situations in progress: The following SQL query is the result set that meets the above four requirements, meeting the title requirementsSELECT * FROM Table name WHERE 1=1 and(start_time is null or start_time<now()) and(end_time is null or end_time>now()) Mybatis writing method, the start time and end time input parameters are allowed to be empty as shown in the figure: <if test="record.startDate != null and record.startDate != '' or record.endDate != null and record.endDate != '' "> AND id in (select id from rht_product_price where 1=1 <if test="record.startDate != null and record.startDate != ''"> and start_date <= #{record.startDate,jdbcType=VARCHAR} </if> <if test="record.endDate!= null and record.endDate != ''"> and end_date >= #{record.endDate,jdbcType=VARCHAR} </if> ) </if> This is the end of this article about MySQL judging whether the current time is between the start and end time and the start and end time are allowed to be empty. For more relevant information about MySQL judging whether the current time is between the start and end time, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Example of using CSS filter to write mouse over effect
>>: Ideas and codes for implementing iframe to intercept part of the website content
Download image docker pull mysql:5.7 docker pull ...
Today I will use the server nginx, and I also nee...
The situation is as follows: (PS: The red box repr...
1. Create a new user wwweee000 [root@localhost ~]...
Introduction: The disadvantages of storing all da...
MySQL backup Cold backup:停止服務進行備份,即停止數據庫的寫入Hot ba...
Part 1 HTML <html> -- start tag <head>...
Table of contents Events in js Event Type Common ...
This article shares a blinds special effect imple...
Some fault code tables use the following design p...
Tomcat server is a free and open source Web appli...
Quickly install the tensorflow environment in Doc...
MySQL is a commonly used open source database sof...
Table of contents 1. Digital Operation (1) Genera...
When inserting a set of data into the MySQL datab...