select count(*) as index_count,model from C_ACCESS_LOG group by model,PAGEID
having model in (1503,2090,1511,1520,1529) and PAGEID in (1505,1479,1462,1481,1569)
得出的结果是
index_count model
8 1520但我想要的结果是
index_count model
8 1520
0 1503
0 2090
0 1511
0 1529
请问如何做呢(顺序不要求和上面一样,只要都列出来就可以),谢谢
having model in (1503,2090,1511,1520,1529) and PAGEID in (1505,1479,1462,1481,1569)
得出的结果是
index_count model
8 1520但我想要的结果是
index_count model
8 1520
0 1503
0 2090
0 1511
0 1529
请问如何做呢(顺序不要求和上面一样,只要都列出来就可以),谢谢
解决方案 »
- mdx 查询
- orale获取字符串中的相关子串,求助。
- Weblogic9.1通过OCI方式配置Oracle数据源报no ocijdbc10 in java.library.path 错误
- 问个查询问题!!!
- 32位HP-UX升级到64位,oracle8.1.3升级到10g,超成数组越界可能是什么原因?
- 请问merge函数是否能只使用match update操作?
- 如何查找TNS listener 所占用的端口号? (用网卡的tcp/ip 来过滤端口,所以必须得知道这些端口以便添加进去)
- 请问如何完全删除Oracle 8.0.6
- SqlServer中的ISNULL函数在Oracle中用哪个来代替,
- oracle过程中的as和is有什么区别吗
- PL/SQL中一打逗号就死机了?
- sqlcode=4098 请问是什么 sqlcode一般怎么查错误信息啊
where model ='1503' and PAGEID in (1505,1479,1462,1481,1569)
这样得出的结果是
index_count
0
select count(*) as index_count from C_ACCESS_LOG
where model ='1520' and PAGEID in (1505,1479,1462,1481,1569)
这样得出的结果是
index_count
8而我现在想要的结果是
index_count model
8 1520
0 1503
应该怎样做呢
pageid number
model varchar
mid varchar
select count(*) as index_count,model from from C_ACCESS_LOG where model in (1503,2090,1511,1520,1529) and PAGEID in (1505,1479,1462,1481,1569) group by model;
index_count model
8 1520
select count(*),'1503' as index_count from C_ACCESS_LOG
where model ='1503' and PAGEID in (1505,1479,1462,1481,1569)
)
union
(
select count(*),'1520' as index_count from C_ACCESS_LOG
where model ='1520' and PAGEID in (1505,1479,1462,1481,1569)
)
这样写能做到我要的效果,可是一个model值就要1句,这样太烦了,能合为一句吗
否则C_ACCESS_LOG 表里没有的model值,是不会出现在结果里的
(select count(*) as index_count,model from C_ACCESS_LOG group by model,PAGEID
having model in (1503,2090,1511,1520,1529) and PAGEID in (1505,1479,1462,1481,1569)) t1
Right Join
(Select Model From C_ACCESS_LOG Where model in (1503,2090,1511,1520,1529)) t2
On t1.Model = t2.Model;
select count(model) as index_count,model from from C_ACCESS_LOG where model in (1503,2090,1511,1520,1529) and PAGEID in (1505,1479,1462,1481,1569) group by model;