zoukankan      html  css  js  c++  java
  • sql 时间函数用法

    IF(g.give_integral > -1, g.give_integral, c.goods_price)
    这个函数的结果要根据g.give_integral的值,如果g.give_integral大于-1函数值就是g.give_integral,否则函数值就是c.goods_price。
    
    SELECT COUNT(r.created_by) AS sa_num,ss.truename,ss.id,
    (SELECT COUNT(1) FROM store_sequence_statue WHERE paycar='0' AND r.customerid='3040000100000000002' AND STR_TO_DATE(r.created_time,'%Y-%m-%d') BETWEEN '2015-09-13' AND '2015-09-15') AS ontime_car,
    (SELECT COUNT(1) FROM store_sequence_statue WHERE paycar='1' AND r.customerid='3040000100000000002' AND STR_TO_DATE(r.created_time,'%Y-%m-%d') BETWEEN '2015-09-13' AND '2015-09-15') AS notime_car,
    (IF(COUNT(r.created_by)=0,0,(SELECT COUNT(1) FROM store_sequence_statue WHERE paycar='0' AND r.customerid='3040000100000000002' AND STR_TO_DATE(r.created_time,'%Y-%m-%d') BETWEEN '2015-09-13' AND '2015-09-15')/COUNT(r.created_by))) AS shulv
    FROM store_repair r INNER JOIN sys_admin ss ON ss.id=r.created_by WHERE r.customerid ='3040000100000000002' AND STR_TO_DATE(r.created_time,'%Y-%m-%d') BETWEEN '2015-09-13' AND '2015-09-15' GROUP BY r.created_by

     

  • 相关阅读:
    RESTful规范1
    Django -- 发送HTML格式的邮件
    11.10 vue
    Selenium 使用
    Beautiful Soup的用法
    Pthon常用模块之requests,urllib和re
    爬虫--工具安装Jupyter anaconda
    11-3
    Python -- tabulate 模块,
    Python -- queue队列模块
  • 原文地址:https://www.cnblogs.com/baijin05/p/5040351.html
Copyright © 2011-2022 走看看