sql联合查询 一条select语句 查询多个结果,显示
2016-07-06 16:22
429 查看
联合查询 举例:
select (select COUNT(id) from emailcontent where state=1 and hasRead=0) as a,
(select COUNT(id) from emailcontent where state=1 and hasRead=1) as b,
(select COUNT(id) from emailcontent where state=1 and hasRead=2) as c
结果集: [{a=0, b=31, c=0}]
一条select语句实现多条查询语句
select (select COUNT(id) from emailcontent where state=1 and hasRead=0) as a,
(select COUNT(id) from emailcontent where state=1 and hasRead=1) as b,
(select COUNT(id) from emailcontent where state=1 and hasRead=2) as c
结果集: [{a=0, b=31, c=0}]
一条select语句实现多条查询语句
相关文章推荐
- MongoDB增删改查
- Some current MySQL Architecture writings
- MongoDB启动和停止
- mssql临时表
- Oracle字符串处理 函数
- Red Hat安装MySQL之旅
- mysql 将null转代为0(转)
- 详解 MySQL 中的 explain
- Memcached初步认识
- oracle基础学习
- ubuntu环境下mysql允许远程的配置
- 关于添加Adventure Works for SQL Server 2012出错
- SQL的Join语法
- mongodb入门学习小记
- Oracle中*和其他字段组合查询的说明
- Oracle 11g修改数据库字符集
- MemcacheQ 安装与使用
- HANA 建模(一)——属性视图
- mysql中isnull小记
- mysql 5.6 oom 图