zoukankan      html  css  js  c++  java
  • sql语句

    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;
  • 相关阅读:
    【MongoDB】windows下搭建Mongo主(Master)/从(slave)数据库同步
    视图与暂时表
    Highcharts构建分组分类坐标轴
    iOS可持续化集成: Jenkins + bundler + cocoapods + shenzhen + fastlane + pgyer
    Internationalization composition diagram
    ASCII表 基本记忆 -- C
    Java内部类
    Idea过期继续激活~
    Spark SQL 用户自定义函数UDF、用户自定义聚合函数UDAF 教程(Java踩坑教学版)
    Spark源码分析之Spark-submit和Spark-class
  • 原文地址:https://www.cnblogs.com/isungge/p/9072803.html
Copyright © 2011-2022 走看看