• mysql sum()函数 , 计算总和


    mysql> select * from table1;
    +----------+------------+-----+---------------------+
    | name_new | transactor | pid | order_date          |
    +----------+------------+-----+---------------------+
    | 1hahha   | 1xiaohong  |   1 | 2019-08-04 20:45:47 |
    | 2hahha   | 2xiaohong  |   2 | 2019-08-04 20:45:57 |
    | 3hahha   | 3xiaohong  |   3 | 2019-08-04 20:46:02 |
    | 4hahha   | 4xiaohong  |   4 | 2019-08-04 20:46:05 |
    | 3hahha   | bob        |   5 | 2019-08-04 20:46:08 |
    | 3hahha   | lee        |   6 | 2019-08-04 20:46:12 |
    +----------+------------+-----+---------------------+
    6 rows in set (0.00 sec)
    
    
    mysql> select * from table1 where minute(order_date)=46;
    +----------+------------+-----+---------------------+
    | name_new | transactor | pid | order_date          |
    +----------+------------+-----+---------------------+
    | 3hahha   | 3xiaohong  |   3 | 2019-08-04 20:46:02 |
    | 4hahha   | 4xiaohong  |   4 | 2019-08-04 20:46:05 |
    | 3hahha   | bob        |   5 | 2019-08-04 20:46:08 |
    | 3hahha   | lee        |   6 | 2019-08-04 20:46:12 |
    +----------+------------+-----+---------------------+
    4 rows in set (0.00 sec)
    
    
    mysql> select sum(pid) as pidsum from table1 where minute(order_date)=46;
    +--------+
    | pidsum |
    +--------+
    |     18 |
    +--------+
    1 row in set (0.00 sec)

  • 相关阅读:
    EntityFramework ,ef 介绍
    MVC controller and View
    MVC 模型
    mvc 控制器,视图,Razor 语法
    MVC 安装
    MVC 介绍
    vue 3.0 项目搭建移动端 (三) computed 和 methods 和 watch
    vue 3.0 项目搭建移动端 (二) Vue-router: router-link 与 router-view keep-alive
    添加网络js文件
    过滤 filter
  • 原文地址:https://www.cnblogs.com/sea-stream/p/11300003.html
Copyright © 2020-2023  润新知