oracle解决多表关联分组查询问题
2012-09-25 14:21
281 查看
做了一个功能需要分组查询,同时查询A表分组查询的ID需要关联B表的数据,本来想两个表关联查询,但是报group by 语法不正确。所以做了以下修改。
select count(*), cindexid,(select vindexcode from comindex where pk_index =cindexid) as vindexcode ,iquesttype from rqt_examquest where pk_examquest in(
select cexamquestid from rqt_examquest_b2 where cjobtypeid = '1000LSZY123456100001' or cjobtypeid='1001LSZYp3U34Bxgv7V4'
) group by cindexid , iquesttype having iquesttype = 1 or iquesttype = 2 or iquesttype = 3 order by cindexid
select count(*), cindexid,(select vindexcode from comindex where pk_index =cindexid) as vindexcode ,iquesttype from rqt_examquest where pk_examquest in(
select cexamquestid from rqt_examquest_b2 where cjobtypeid = '1000LSZY123456100001' or cjobtypeid='1001LSZYp3U34Bxgv7V4'
) group by cindexid , iquesttype having iquesttype = 1 or iquesttype = 2 or iquesttype = 3 order by cindexid
相关文章推荐
- oracle解决多表关联分组查询问题
- oracle分页查询结果集重复问题&解决方法
- Oracle:sqlplus查询出的中文是乱码问题的解决
- oracle去重查询/删除,distinct多列问题解决方案!
- 关于oracle树结构查询 展示 分组,查找父节点,查找子节点问题
- 使用连接查询解决一对一实体关联查询时的懒加载问题
- Oracle Form 问题集锦 - 加弹性域后查询报错的解决
- Oracle 通过触发器 来创建 同步临时表 及处理 通过 自治事务 来解决 查询 基表的问题
- oracle使用LEFT JOIN关联产生的问题在查询结果中使用CASE WHEN 无法判断
- 如何解决oracle分页查询数据重复问题
- 解决oracle中lob数据类型查询问题
- 解决Oracle Sqlplus查询折行、折页的问题
- Oracle模糊查询之(4.采用全文索引解决模糊查询,给出具体步骤)采用全文索引解决模糊查询速度慢的问题[主文]
- Oracle SQL使用笛卡尔连接、正则表达式和层次查询、union all、unpiovt 解决多列值筛选、列转行问题
- oracle新建用户导入scott的表,解决新用户查询scott表时出现表或视图不存在的问题
- oracle分页查询数据重复问题的解决
- 【转】解决Oracle分页查询中排序与效率问题
- ORACLE - sqlplus查询oracle数据库返回结果为“?”或者乱码问题解决
- 当回车关联查询按钮时,如何解决页面重新刷新的问题!
- oracle分页查询数据重复问题的解决