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
  • 相关阅读:
    解决Ubuntu下博通网卡驱动问题
    泛型的使用
    Http常见的响应头
    URL
    Tomcat目录结构
    Tomcat常见启动问题
    J2EE的13种核心技术
    css中相对定位和绝对定位
    Link标签
    html基本结构
  • 原文地址:https://www.cnblogs.com/scode2/p/10791867.html
Copyright © 2011-2022 走看看