我试图从查询中获取被拒绝的统计信息,因此,我必须对查询进行反向工程。对于每种情况,我必须找出拒绝了多少条记录。我已经在查询下面创建了,但是在正确选择数据方面仍然存在问题。有人可以帮忙吗?
原始查询:
Select * FROM TBL_SRC_CALL2VODC SRC,
WHERE UPPER(SRC.STTS_VOD_C) ='SUBMITTED_VOD'
AND CAST(SRC.is_parent_call_vod_c AS INT) =1
AND (CAST(SRC.total_expns_incurred_gzm_c AS INT) > 0
OR CAST(SRC.sanofi_total_other_expenses__c AS INT) > 0)
我已经创建的查询:
Select COUNT(id) from tbl_src_call2vodc src where
(SRC.total_expns_incurred_gzm_c is null
AND SRC.sanofi_total_other_expenses__c is null) or (UPPER(SRC.STTS_VOD_C)!='SUBMITTED_VOD')
or (CAST(SRC.is_parent_call_vod_c AS INT)!=1)
此外,我希望能够在今天的数据加载之前检查历史记录表中是否存在类似的记录。
查询:
select * from TBL_TDMS_MEETING_DTLS_FL_HIST
where TRUNC(load_dt) > TRUNC(SYSDATE) where substr(meetingid,6)
答案 0 :(得分:0)
如果没有NULL,则只需使用NOT
:
WHERE NOT (UPPER(SRC.STTS_VOD_C) = 'SUBMITTED_VOD' AND
CAST(SRC.is_parent_call_vod_c AS INT) = 1 AND
(CAST(SRC.total_expns_incurred_gzm_c AS INT) > 0 OR
CAST(SRC.sanofi_total_other_expenses__c AS INT) > 0
)
)
如果列中可以包含NULL
,则解决方案会更加复杂。