mysql查询区分大小写:
SELECT id,developer FROM products WHERE developer != '' and developer = binary('LYNN')
在查找的条件值加上的binary()
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