UPDATE v9_k12_homework_tea SET `yufa_type` = CASE `yufa_type` WHEN 0 THEN '0' WHEN 1 THEN '31' WHEN 2 THEN '43' WHEN 3 THEN '48' WHEN 4 THEN '60' WHEN 5 THEN '61' WHEN 11 THEN '181' WHEN 13 THEN '200' WHEN 14 THEN '203' WHEN 18 THEN '3' WHEN 19 THEN '7' WHEN 21 THEN '8' WHEN 22 THEN '10' WHEN 31 THEN '34' WHEN 33 THEN '38' WHEN 35 THEN '207' WHEN 38 THEN '269' WHEN 40 THEN '116' WHEN 41 THEN '118' WHEN 45 THEN '134' WHEN 48 THEN '144' WHEN 53 THEN '161' WHEN 59 THEN '170' WHEN 73 THEN '194' WHEN 80 THEN '218' WHEN 81 THEN '227' WHEN 90 THEN '283' WHEN 91 THEN '284' WHEN 92 THEN '285' WHEN 93 THEN '286' WHEN 94 THEN '288' WHEN 95 THEN '287' WHEN 96 THEN '289' WHEN 99 THEN '292' WHEN 100 THEN '293' WHEN 101 THEN '294' WHEN 102 THEN '295' WHEN 103 THEN '32' WHEN 115 THEN '152' END select FROM_UNIXTIME(1156219870); 日期转换为UNIX时间戳用函数: UNIX_TIMESTAMP() Select UNIX_TIMESTAMP(’2006-11-04 12:23:00′); from_unixtime(time_stamp) -> 将时间戳转换为日期,unix_timestamp(date) -> 将指定的日期或者日期字符串转换为时间戳 DATE_FORMAT() 函数用于以不同的格式显示日期/时间数据 and date_format( ordrq, '%Y-%m-%d %H:%i:%s' ) between '$start' and '$end' 查看重复sql SELECT id, `userid`,`chi_userid`,`type`,count(*) FROM `dgj_jifen` WHERE 1 group by `userid`,`chi_userid`,`type` having count(*)>1 update `dgj_member_detail` set `xxzj_old`=`xxzj`,`xxzj`='249' WHERE 1 and userid in () a.ordrq between date_sub(now(),interval 21 day) and now() WHERE (a.ordrq between date_sub(now(),interval 21 day) and now()) OR 最近21天 SELECT tid,count(distinct ordrq) as tot FROM `dgj_ord_km` WHERE 1 and ordrq<='2018-04-27' and status=0 group by tid having tot=8 刚上课8天的老师(解决分组两个字段的问题) select *,group_concat(distinct name) from table group by name;