Home > Database > Mysql Tutorial > mysql数据库字段判断语句_MySQL

mysql数据库字段判断语句_MySQL

WBOY
Release: 2016-06-01 13:37:34
Original
1253 people have browsed it

bitsCN.com


mysql数据库字段判断语句

 

一、CASE field WHEN value THEN value WHEN ... THEN ... ELSE ... 

 

sample:

 

Sql代码  

select CASE usertype WHEN 1 '管理员' WHEN 2 THEN '策划' WHEN 3 THEN '测试员' ELSE '未定义' AS usertype FROM users  

 

二、IF( exp, value, value) 

Sql代码  

IF (1 = 1,'A','B')  

bitsCN.com
Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template