A mysql-like php switch case statement.
Here is an example of group summation: select sum(redpackmoney) as stota,ischeck from t_redpack group by isCheck Use case when : select sum(redpackmoney) as stota, (CASE isCheck WHEN '1' THEN 'checktrue' WHEN '0' THEN 'uncheck' WHEN '-1' THEN 'checkfalse' ELSE 'unknow' END) as checkinfo from t_redpack group by isCheck In checkinfo, -1, 0, 1 are replaced with checkfalse, uncheck, checktrue (CASE WHEN performs string replacement processing) The above is a simple example of using the case when statement in MySQL. You may also be interested in:
|
<<: Vue implements simple data two-way binding
>>: How to start tomcat using jsvc (run as a normal user)
CentOS6.9+Mysql5.7.18 source code installation, t...
Table of contents General upload component develo...
the difference: 1. InnoDB supports transactions, ...
Step 1: Change DATABASES in setting.py # Configur...
How can we say that we should avoid 404? The reas...
Hello everyone, I wonder if you have the same con...
Table of contents Preface Local storage usage sce...
Preface: I reinstalled win10 and organized the fi...
I won’t go into details about the theory of UDP. ...
Types of joins 1. Inner join: The fields in the t...
XHTML is the basis of CSS layout. jb51.net has al...
Despite props and events, sometimes you still nee...
Table of contents Preface 1. Preview of office do...
This article mainly introduces the sample code of...
1. Enter the following address in the browser htt...