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)
Table of contents Introduction The following is a...
Environment: MacOS_Cetalina_10.15.1, Mysql8.0.18,...
Demand background The project is made using Vue, ...
Download image docker pull mysql:5.7 docker pull ...
This article installs Google Input Method. In fac...
Table of contents Overview Precautions 1. Usage 2...
This article example shares the specific code of ...
Modify /etc/my.cnf or /etc/mysql/my.cnf file [cli...
1. Check the synchronization status of A and B da...
Please open the test page in a mainstream browser...
Table of contents 1. Filter, map, and reduce proc...
Modify the group to which a user belongs in Linux...
1. Virtual Machine Preparation 1. Create a new vi...
Overview Indexing is a skill that must be mastere...
Preface The logical judgment statements we use in...