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 1. Use slots to make components...
First, let's look at an example of memory rel...
Apollo open source address: https://github.com/ct...
1. Introduction First of all, we need to answer a...
1 Installation Download the corresponding unzippe...
Event bubbling, event capturing, and event delega...
Storage Engine What is a database storage engine?...
Get the current time: select current_timestamp; O...
Recently, I encountered a problem in the process ...
What is the purpose of this sentence? Copy code Th...
1. To download the MySQL database, visit the offi...
= Only when setting and updating does it have the...
Table of contents Preface Communication between t...
1. es startup command: docker run -itd -e TAKE_FI...
Table of contents javascript tamper-proof object ...