zoukankan      html  css  js  c++  java
  • sql 统计整理

    Pgsql

    字符字段转整型查询:

    SELECT mon_id as staTime,SUM (CAST ( index_value AS INT )) AS totalCount FROM aidata.rep_index_values_m 

      SELECT ext_dim1 sex, sum(index_value::NUMERIC) total FROM aidata.rep_index_values_y T

    mybatis in 查询:

    <if test="orgIdList != null">
                <if test="orgIdList.size() > 0">
                    and org_id IN
                    <foreach collection="orgIdList" item="item" open="("
                             separator="," close=")">
                        #{item}
                    </foreach>
                </if>
            </if>

    Mysql:

    子查询

    SELECT
            temp1.count AS total,
            temp2.count AS num1,
            temp3.count AS num2 
        FROM
        ( SELECT count( 1 ) AS count FROM t_e_xiexiexie WHERE STATUS = '1' ) temp1,
        ( SELECT count( 1 ) AS count FROM t_e_xiexiexie WHERE true AND createtime >= '2019-06-13' AND createtime < '2019-06-14' ) temp2,
        ( SELECT count( 1 ) AS count FROM t_e_xiexiexie WHERE STATUS = '9' AND lastmodifytime >= '2019-06-13' AND lastmodifytime < '2019-06-14' ) temp3
  • 相关阅读:
    python基础(1)#1,2,3,4可组成多少不重复的三位数
    HTML/CSS 学习笔记
    (转) 杨元:CSS浮动(float,clear)通俗讲解
    前端:HTML
    Servlet
    Maven 安装
    单例模式
    项目随笔
    树状结构--迭代
    DB的封装
  • 原文地址:https://www.cnblogs.com/scode2/p/10791867.html
Copyright © 2011-2022 走看看