我的逻辑是生成重复值,我需要过滤到此
中的一个值 25-01-2018 01:12 PM
25-01-2018 01:12 PM
25-01-2018 01:12 PM
25-01-2018 06:12 PM
25-01-2018 06:12 PM
25-01-2018 06:12 PM
我需要输出:
25-01-2018 01:12 PM
25-01-2018 06:12 PM
它应该删除我使用的postgresql中的重复值
select a.check_in,a.check_out, b.break_reason from
(
select
string_agg(to_char((check_in ::TIMESTAMP::VARCHAR || ' UTC')::TIMESTAMPTZ AT TIME ZONE 'Asia/kolkata','dd-mm-YYYY HH12:MI AM'),E'\n' ) as check_in,
string_agg(to_char((check_out ::TIMESTAMP::VARCHAR || ' UTC')::TIMESTAMPTZ AT TIME ZONE 'Asia/kolkata','dd-mm-YYYY HH12:MI AM'),E'\n' ) as check_out,
a.break_reason
from account_analytic_line a
inner join project_task p on a.task_id = p.id
inner join sale_order_line sl on sl.id = p.sale_line_id
inner join sale_order so on so.id = sl.order_id
where a.name = 'pause' and so.id= %s
group by a.check_in,a.check_out,a.break_reason
order by a.break_reason
)a
right join
(select unnest(string_to_array('Waiting for Customer Approval;Others;Waiting for Parts;Waiting for Decision;Waiting for Diagnosis',';')) as break_reason)b
on a.break_reason = b.break_reason
order by b.break_reason desc
这里check_in和check_out产生多个日期。我需要在这里删除重复