sql - detete rows after fetching the data from them -


i have table named auditrtailreference fetching data running following query

select t3.destinationid input,     t1.sourceid raw,     t1.outtime::text,     t6.destinationid out_file,     t4.outtime::text out_time,     t1.bytes inbytes,     t6.bytes outbyte,     t5.cdrs inputcdrs,     t6.cdrs 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 auditrtailreference t1 left join auditrtailreference t2 on t2.sourceid = t1.destinationid     , t2.event = '80'     , t2.innodename 'sdp%_sftp' left join auditrtailreference t3 on t3.sourceid = t2.destinationid     , t3.event = '68' left join auditrtailreference t4 on t4.sourceid = t3.destinationid     , t4.event = '67'     , (         t4.innodename 'sdp%_collector'         or t4.innodename 'sdp%_collector'         ) left join auditrtailreference t5 on t5.sourceid = t4.destinationid     , t5.event = '73' left join auditrtailreference t6 on t6.destinationid t3.destinationid || '%'     , t6.event = '68'     , (         t6.outnodename 'sdp%_distributer'         or t6.outnodename 'sdp%_arch'         or t6.outnodename 'sdp%_distributor'         or t6.outnodename 'sdp%_distributor'         or t6.outnodename 'sdp%_distributer'         ) t1.event = '67'     , t1.innodename 'sdp%_sftp'     , t3.destinationid '%'     , t1.outtime >= '2014/09/09 00:00'     , t1.outtime <= '2014/09/10 19:51'     , t3.outnodename '%init_dist'; 

now need delete rows fetched valid data (valid data here means columns have fetched must not null)

now why doing because receiving data in form of files.... inserting tables, running daemon in background fetches necessary data , insert table.

after need remove rows initial table have inserted final table

you need identify primary key in table (auditrtailreference) , can create delete select query

maybe example:

delete auditrtailreference row_id in    (select row_id auditrtailreference... join .... where...) 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -