mysql查询区分大小写与自定义排序

mysql查询区分大小写:

SELECT
id,developer FROM products WHERE developer != '' and developer = binary('LYNN')


在查找的条件值加上的binary()

来源:http://my.oschina.net/xiangtao/blog/33983

 

mysql自定义排序:

select * from user order by field(roleId,2,3,4,1,5);

select * from user order by field(roleId,'张三','李四','王五');
$str = "'张三','李四','王五'";
select * from user order by field(roleId,
$str);

$arr
= array('张三','李四','王五');
$
str = "'".implode("','", $arr)."'";
select * from user order by field(roleId,$str);

来源:技术群

 

CONCAT 拼接mysql

update ratings_store set update_time = CONCAT('2016-08-03',right(update_time,9))

来源:http://honly-java.iteye.com/blog/1633033

 

select
    (case when id = '123' then
        '000'
    else
        id 
    end)  id
from table

 

select width,
case height
when '1' then ''
when '2' then ''
when '3' then ''
end '大写'
from table 

 

CASE WHEN col_1 IN ( 'a', 'b') THEN '第一类'
         WHEN col_1 IN ('a')       THEN '第二类'

http://blog.csdn.net/leamonjxl/article/details/6239948

 

posted @ 2016-06-17 16:54  蚂蚁羽  阅读(1086)  评论(0编辑  收藏  举报