How can I select distinct inside an array based on date?
<p>I would like to display the value (distinctly) from my database (PostgreSQL)
here is my code:</p>
<pre><code>SELECT distinct t.*, round(SUM(percentage)OVER (order by agentname rows between unbounded preceding and current row),3) AS cumulative
FROM (
  SELECT 
    a.*,
    COUNT(*) AS frequency,
   round(COUNT(*) * 100.00 / SUM(COUNT(*)) OVER (),4) AS percentage
  FROM 
      (select agentname,inputdate, unnest(array[ WSalamPembuka,WKonfirmasiNamaCust, WVerifikasiData,WKemampuanBertanya,WProductKnowledge,WSolusi,WAlternativeSolusi,WSistemPelaporan,WEmpati,WResponsif,WRamahSopan,WPercayaDiri,WHoldCall,WOfferHelp,WPenutup]) as weakness                        
                from call )as a 
                  WHERE a.agentname like '%wendra%' and a.weakness is not null and a.weakness !='' and a.inputdate between '01/12/2015' and  '08/01/2016'
                  group by a.agentname,a.weakness,a.inputdate
                  order by frequency desc
                ) AS t
                ORDER BY frequency DESC 

        
 
</code></pre>
<p>And the result I got is:
<a href="https://i.stack.imgur.com/GPrAW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GPrAW.png" alt="enter image description here" /></a></p>
<p>As you can see I got duplicate data here. I want it to be like:</p>
<p><a href="https://i.stack.imgur.com/fnyue.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fnyue.png" alt="enter image description here" /></a></p>
<p>Any trick to solve this?</p>