Get the App
SLTechnology News&Howtos  ›  Development  › 

How to determine whether the current time is between the start and end times when the mysql start and end times are allowed to be empty

Shulou Source: shulou.com Published: 2022-06-03 18:34:45 10月03日 Update

This article mainly explains "how to judge whether the current time is between the start time and the end time under the condition that the mysql start and end time is allowed to be empty". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought. Let's study and learn how to determine whether the current time is between the start and end times when the mysql start and end times are allowed to be empty.

Catalogue

Requirements: query active data in progress

The following sql queries the result sets that meet the above four requirements, reaching the title requirements.

Requirements: query active data in progress

There are the following situations in progress:

1. The start time is empty, the end time is empty, and the resulting data will always be data in progress

two。 If the start time is empty and the end time is not empty, the current time is before the end time and is the data in progress

3. If the start time is not empty and the end time is empty, the current time is after the start time and is the data in progress

4. If the start time is not empty and the end time is not empty, the data within the start and end time period of the current time is in progress

The following sql queries the result sets that meet the above four requirements, reaching the title requirement SELECT * FROM table name WHERE 1 and (start_time is null or start_timenow ())

Mybatis. The input parameters of start time and end time are allowed to be empty.

As shown in the figure:

AND id in (select id from rht_product_price where 1 and start_date = # {record.endDate,jdbcType=VARCHAR}) Thank you for your reading. This is the content of "how to judge whether the current time is between the start time and the end time when the mysql start and end times are allowed to be empty". After the study of this article I believe you have a deeper understanding of how to judge whether the current time is between the start and end time under the condition that the mysql start and end time is allowed to be empty, and the specific use needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Time data requirements between conditions queries results learning content situation activities writing parameters that is ideas articles time periods more directories knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS OPPO Reno Huawei Xiaomi Apple