sql 用于提取审核跟踪数据的几个查询。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 用于提取审核跟踪数据的几个查询。相关的知识,希望对你有一定的参考价值。

/**
 * Returns count of unique site/user combinations.
 */
SELECT count(DISTINCT(uuid)) FROM `pmapi_pum_reviews`

/**
 * Get count of each reason. 
 * Use Having to limit these results or pivot the table.
 */
SELECT `reason`, COUNT(*) FROM `pmapi_pum_reviews` GROUP BY `reason`

/**
 * Get count & percentage of each reason.
 * Use Having to limit these results or pivot the table.
 */
SELECT reason, COUNT(*) AS count, concat(FORMAT((SUM(100) / total),2),'%') AS percentage FROM `pmapi_pum_reviews` CROSS JOIN (SELECT COUNT(*) AS total FROM `pmapi_pum_reviews` ) x GROUP BY reason

/**
 * Get list of reasons with more than 3 submissions.
 */
SELECT `reason`, count(*) from `pmapi_pum_reviews` group by `reason` having count(*) > 3

以上是关于sql 用于提取审核跟踪数据的几个查询。的主要内容,如果未能解决你的问题,请参考以下文章

sql查询指定月份之前的几个月

sql语句 查询一个月的几个周的数据

优化mysql数据库的几个步骤

重命名时Oracle 12C审核触发器

小米笔试题中遇到的关于学生成绩查询的几个SQL语句

用于从 VIEW 表中提取数据的 SQL 透视查询