내가 auditrtailreference
라는 이름의 테이블이있는 나는 다음과 같은 쿼리를 실행하여 일부 데이터를 가져 오는하고 있습니다detete 행 그들로부터 데이터를 가져 오는 후
SELECT t3.destinationid AS input,
t1.sourceid AS Raw,
t1.outtime::TEXT,
t6.destinationid AS out_file,
t4.outtime::TEXT AS out_time,
t1.bytes AS inbytes,
t6.bytes AS outbyte,
t5.cdrs AS inputcdrs,
t6.cdrs AS outputcdrs,
t6.partial_cdrs,
t6.duplicate_cdrs,
t6.discarded_cdrs,
t6.created_cdrs,
t6.corrupted_cdrs,
t6.created_files,
t6.duplicate_files,
t6.corrupted_files,
t6.partial_files,
t6.discarded_files,
t6.empty_files
FROM auditrtailreference t1
LEFT JOIN auditrtailreference t2 ON t2.sourceid = t1.destinationid
AND t2.event = '80'
AND t2.innodename LIKE 'SDP%_SFTP'
LEFT JOIN auditrtailreference t3 ON t3.sourceid = t2.destinationid
AND t3.event = '68'
LEFT JOIN auditrtailreference t4 ON t4.sourceid = t3.destinationid
AND t4.event = '67'
AND (
t4.innodename LIKE 'SDP%_Collector'
OR t4.innodename LIKE 'SDP%_collector'
)
LEFT JOIN auditrtailreference t5 ON t5.sourceid = t4.destinationid
AND t5.event = '73'
LEFT JOIN auditrtailreference t6 ON t6.destinationid LIKE t3.destinationid || '%'
AND t6.event = '68'
AND (
t6.outnodename LIKE 'SDP%_distributer'
OR t6.outnodename LIKE 'SDP%_Arch'
OR t6.outnodename LIKE 'SDP%_distributor'
OR t6.outnodename LIKE 'SDP%_Distributor'
OR t6.outnodename LIKE 'SDP%_Distributer'
)
WHERE t1.event = '67'
AND t1.innodename LIKE 'SDP%_SFTP'
AND t3.destinationid LIKE '%'
AND t1.outtime >= '2014/09/09 00:00'
AND t1.outtime <= '2014/09/10 19:51'
AND t3.outnodename LIKE '%init_Dist';
지금은 내가 유효을 가져온있는 모든 행을 삭제해야 데이터 (여기서 유효한 데이터는 내가 가져온 모든 열이 null이 아니어야 함을 의미 함)
이제 파일의 형식으로 데이터를 수신하고 있기 때문에 내가 이것을하고있는 이유는 무엇입니까? 테이블, 이제 나는 백그라운드에서 데몬을 실행하여 필요한 데이터를 가져오고 다른 테이블에 삽입합니다. 내가 마지막 테이블에 삽입 한 초기 테이블의 모든 행을 제거하기 위해 필요한이 후
내가 PostgreSQL을 데이터베이스를 사용하고 내 데몬은 얼랑 과정입니다 :) – Khanjarrr
나는 당신이 당신의 SQL을 정리하면이 질문의 가독성이 먼 길을 갈 것이라고 생각합니다. 서식 지정은 친구입니다. – paqogomez