Home Database Mysql Tutorial mysql存储过程时间月份减法_MySQL

mysql存储过程时间月份减法_MySQL

Jun 01, 2016 pm 12:59 PM
Subtraction month process

declare startTime VARCHAR(19) default '2014-00-00 00:00:00';
declare tempTime VARCHAR(19) default NOW();
declare endTime VARCHAR(19) default DATE_SUB(tempTime,INTERVAL '3' MONTH); -- 后退三个月时间

DECLARE MONTHSTR VARCHAR(7) default SUBSTR(endTime,1,7);
set endTime=CONCAT(MONTHSTR,'-00 00:00:00');


SELECT startTime as startTime,endTime AS endTime;

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1268
29
C# Tutorial
1243
24
Detailed explanation of the implementation method of converting PHP months to English months Detailed explanation of the implementation method of converting PHP months to English months Mar 21, 2024 pm 06:45 PM

This article will introduce in detail how to convert months in PHP to English months, and give specific code examples. In PHP development, sometimes we need to convert digital months to English months, which is very practical in some date processing or data display scenarios. The implementation principles, specific code examples and precautions will be explained in detail below. 1. Implementation principle In PHP, you can convert digital months into English months by using the DateTime class and format method. Date

PHP date processing tips: How to calculate the month difference between dates using PHP? PHP date processing tips: How to calculate the month difference between dates using PHP? Mar 20, 2024 am 11:24 AM

PHP date processing tips: How to calculate the month difference between dates using PHP? Date processing is a very common requirement in web development, especially in business logic that needs to be related to time. In PHP, calculating the month difference between dates can be achieved through some methods. This article will introduce how to use PHP to calculate the month difference between two dates and provide specific code examples. Method 1: Use the DateTime class. PHP's DateTime class provides a wealth of date processing methods, including calculating dates.

Divide two integers without using the multiplication, division, and modulo operators Divide two integers without using the multiplication, division, and modulo operators Sep 21, 2023 pm 12:41 PM

In this problem, we only need to divide two integers without using multiplication, division and modulo operators. Although we can use addition, multiplication or bit operations. The problem statement states that we will get two integers x and y. Without using multiplication, division, or the modulo operator, we need to determine the quotient of x divided by y. Example Input: x=15, y=5 Output: 3 Input: x=10, y=4 Output: 2 Input: x=-20, y=3 Output: -6 Method Method 1 (use simple math) here In this method, we will use a simple mathematical algorithm. Here is a step-by-step explanation of the steps we will follow - we will keep subtracting the divisor (i.e. y) from the dividend (i.e. x) until x is greater than or equal to y. when y is greater than x

Oracle database operation skills: detailed explanation of subtraction operation Oracle database operation skills: detailed explanation of subtraction operation Mar 02, 2024 pm 06:15 PM

As a powerful relational database management system, Oracle database provides a wealth of computing operations to meet user needs. In daily database operations, subtraction operation is a common and important operation. It can help us realize the subtraction operation of data to obtain the results we need. This article will discuss in detail the techniques related to subtraction operations in Oracle database, and give specific code examples to help readers better understand and use this function. 1. Basic concepts of subtraction operations in Oracle data

How to do subtraction in Excel How to do subtraction in Excel Mar 20, 2024 pm 02:46 PM

Excel is an indispensable office software in our daily office, so for some people who are learning Excel for the first time, they will always encounter some small problems, such as how to do subtraction in Excel. Today I will talk to my friends Share this operation step. The specific operation steps are below. Friends, come and take a closer look! 1. First, open the Excel data sheet. If Excel wants to do subtraction, it uses formulas, and formulas are generally guided by the equal sign. Therefore, in the cells that need to be subtracted, first enter =, (as shown in red below) Circled portion shown). 2. Then, click on the cell where the minuend is located, and the name of the cell will be automatically added to the formula (as shown in the red circle in the figure below). 3

Back to the Future How to spend 19996-24 Back to the Future How to spend 19996-24 Mar 02, 2024 pm 12:58 PM

In Back to the Future 1999, players will face many level challenges, and each level brings completely different challenges. As one of the levels, 6-24 will definitely have many players thinking about it. You know how to challenge this level, so the following will also bring relevant clearance methods. Back to the Future 19996-24 Clearance Method 1. After burning on level 30 in one sentence, wait for the boss to be stunned and give him a heavy beating. 2. Prioritize using main C and 142d to burn in one round. 3. In the second round, use the auxiliary and nanny's small skills to burn and the main C card to build a big move. 4. The boss will be stunned in three rounds, and then he will be beaten directly with his ultimate move and damage skills.

How to beat Difficulty 3 of Mingtide Fantasyland How to beat Difficulty 3 of Mingtide Fantasyland Feb 28, 2024 pm 10:19 PM

Share how to pass the level of Ming Tide Fantasyland Difficulty 3. Many people in Mingchao are completing level 3 of this fantasyland. This level is actually a bit difficult. Many friends don’t know what to do yet, but don’t worry, the editor brings it to you. If you have read the strategies in it, come and give it a try. How to pass the Bell Turtle character in Difficulty Level 3? Strengthening resonance skills can improve the effect of our aerodynamics. In this way, the attack efficiency will be increased and the damage will be greater. However, if you have Effect replacement can also be exchanged. [Metaphor] Choice for the first three levels: Sun in the Forest: It can greatly increase the damage of Jiyan. If the skill is used more often, it can produce a very good critical hit effect. Protective device: Use resonance technology

Explore the meaning and application of Python operators: addition, subtraction, multiplication and division Explore the meaning and application of Python operators: addition, subtraction, multiplication and division Jan 20, 2024 am 09:21 AM

In-depth understanding of Python operators: addition, subtraction, multiplication, division and their meaning requires specific code examples. In the Python programming language, operators are one of the important tools for performing various mathematical operations. Among them, addition, subtraction, multiplication and division are the most common operators. This article will delve into the meaning of these operators and how to use them in Python. Addition Operator (+) The addition operator is used to add two numbers and can also be used to concatenate two strings. x=5y=3result

See all articles