How to use the concat function in mysql

How to use the concat function in mysql

As shown below:

//Query the year and month of the managefee_managefee table, and use the concat function to form year-month. For example, 2017 and 1 are combined to form 2017-01. .
select CONCAT(a.year,'-',if(a.month<=9,CONCAT('0',a.month),a.month))as date,a.* from managefee_managefee as a;

//Query the data in managefee_managefee with the time period from 2017-01 to 2017-07 select * from
(
select CONCAT(a.year,'-',if(a.month<=9,CONCAT('0',a.month),a.month))as date,a.* from managefee_managefee as a
) b
where b.date between '2017-01' and '2017-07';

The above article on how to use the concat function in MySQL is all I have to share with you. I hope it can give you a reference, and I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • An example of how PHP converts MySQL query results into an array and concatenates them with where
  • Two methods of MySql comma concatenation string query
  • Implementation steps of Mysql merge results and horizontal splicing fields

<<:  JavaScript implements displaying a drop-down box when the mouse passes over it

>>:  Docker Stack deployment method steps for web cluster

Recommend

A brief discussion on VUE uni-app conditional coding and page layout

Table of contents Conditional compilation Page La...

React's component collaborative use implementation

Table of contents Nesting Parent-child component ...

Solution to the MySQL server has gone away error

MySQL server has gone away issue in PHP 1. Backgr...

CSS implements Google Material Design text input box style (recommended)

Hello everyone, today I want to share with you ho...

Summary of the minesweeping project implemented in JS

This article shares the summary of the JS mineswe...

Docker nginx implements one host to deploy multiple sites

The virtual machine I rented from a certain site ...

Detailed process of using nginx to build a webdav file server in Ubuntu

Install nginx Note that you must install nginx-fu...

Book page turning effects made with CSS3

Result:Implementation code: html <!-- Please h...

MySQL 5.7.17 latest installation tutorial with pictures and text

mysql-5.7.17-winx64 is the latest version of MySQ...

Cross-browser development experience summary (I) HTML tags

Add a DOCTYPE to the page Since different browser...

Nodejs uses readline to prompt for content input example code

Table of contents Preface 1. bat executes js 2. T...

Solution to large line spacing (5 pixels more in IE)

Copy code The code is as follows: li {width:300px...