---
title: "mysql的count查询中使用条件"
author: "不念书的小子"
date: "2012-06-28T14:44:10Z"
tags: ["mysql的count查询中使用条件"]
categories: ["数据库"]
slug: "mysql-count"
draft: false
lastmod: "2012-06-28T14:47:33Z"
id: 1570029
url: "https://tompig.iteye.com/blog/1570029"
---

在mysql的count查询中加入条件,在mysql的count查询中加入条件,在mysql的count查询中加入条件,在mysql的count查询中加入条件,

 

 

 select count(pp\_id),count(if(view\_type='2',true,null )),count(if(bounce\_type='1',true,null )),count(DISTINCT program\_id),SUM(play\_interval)   from v\_calculate\_play where app\_id=app\_id