Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone, I need to make a condition that discards duplicate data once you find a correct data, the data may be correct or wrong but when there is a correct data that omits the wrong data.
I have 409 records with duplicate data, I want to omit the duplicate data when I find a correct data and stop counting it.
I have solved the problem using a CASE WHEN 🙂
and 1 = case when call_status ='Failed' and (SELECT count(*)
FROM PRIME.CALLSLOG z
where z.noins = t.noins
and trunc(z.datetime_stamp) = trunc(c.datetime_stamp)
and z.call_status ='Successful'
) > 0 then 0
when call_status ='Successful' then 1
when call_status ='Failed' and (SELECT count(*)
FROM PRIME.CALLSLOG z
where z.noins = t.noins
and trunc(z.datetime_stamp) = trunc(c.datetime_stamp)
and z.call_status ='Successful'
) =0 then 1
else 0
end
Is there a way we could get some sample data that illustrates the problem?
I have solved the problem using a CASE WHEN 🙂
and 1 = case when call_status ='Failed' and (SELECT count(*)
FROM PRIME.CALLSLOG z
where z.noins = t.noins
and trunc(z.datetime_stamp) = trunc(c.datetime_stamp)
and z.call_status ='Successful'
) > 0 then 0
when call_status ='Successful' then 1
when call_status ='Failed' and (SELECT count(*)
FROM PRIME.CALLSLOG z
where z.noins = t.noins
and trunc(z.datetime_stamp) = trunc(c.datetime_stamp)
and z.call_status ='Successful'
) =0 then 1
else 0
end