解决如何连续包两层不能关联主键的情况。
2016-06-15 15:58
316 查看
select a.*, b.* from (select count(1) as numberIll, features_level, sample_inspection_id from (SELECT i.features_level, i.features, i.sample_inspection_id, T.BASEAMINE_ID, T.COLUMN_NAME, V.COLUMN_VALUE, V.DETAIL_ID, (case when i.features = '计数' AND V.COLUMN_VALUE = 'NG' then 0 when (i.features = '计量' AND V.COLUMN_VALUE <> '-') and (to_number(V.COLUMN_VALUE) > i.offset_value_up or to_number(V.COLUMN_VALUE) <= i.offset_value_low) then 0 else 1 end) as illLegal FROM OQC_BASE_STANDRAD_TITLE T, OQC_BASE_STANDRAD_VALUE V, oqc_inspection_sample_item i WHERE T.ID = V.COLUMN_ID and T.STATE = 'A' AND T.BASEAMINE_ID in (select a.id from OQC_INSPECTION_SAMPLE a where a.org_id = 200267 and a.is_v2='1' and state='A' AND A.STATUS='已检验') and t.is_insepection_result = '1' and v.detail_id = i.id) where illLegal = 0 group by features_level, sample_inspection_id) a, OQC_INSPECTION_SAMPLE b where a.sample_inspection_id = b.id
相关文章推荐
- Linux查看端口占用
- 根据邓白氏号码查询公司信息
- 使用MyBatis(八)一对一关联(嵌套查询,嵌套结果)
- 添加jar到本地仓库-对于maven下载不到的jar
- linux下搭建生成HLS所需的.ts和.m3u8文件
- JAVA 学习笔记(二)-注解
- Poj 3013 /hrbust 1419 Big Christmas Tree/昂贵的假花【SPFA+思维】
- 改本机ip为英文
- PHP封装
- Python3 面向对象
- vim 安装
- string中的substr() 和 find() 函数
- C# 自定义光标 WaitCursor
- 由内存屏障查到的
- TCP/IP详解——数据链路层
- swift下nsmutabledicionary从文件读入的写法
- oracle对null赋值默认值
- Ping - Windows自带可执行命令
- iOS 支持 IPv6
- PHP数组