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
Four practical vue custom instructions 1. v-drag ...
As usual, let’s first post the picture effect: Th...
Previously, I introduced the use of the charAt() ...
1. What is Docker? Everyone knows about virtual m...
This post introduces a set of free Photoshop wire...
If you are using Alibaba Cloud Server, you need t...
This article shares with you the installation and...
If your web application runs on only one machine,...
Installation path: /application/mysql-5.7.18 1. P...
1. Indexing principle Indexes are used to quickly...
1. Preparation before installation 1. Download th...
Author: Ding Yi Source: https://chengxuzhixin.com...
Table of contents 1. Master-slave replication Mas...
Table of contents Background 1. What is dns-prefe...
With the popularization of 3G, more and more peop...