postgresql - Remove the repetitive row by checking different column -
i have data sample such below :
how can postgresql eliminate duplicate row check column1 , column2 @ different row ? doing normal comparison still unlucky @ time. hope may share idea.
select d1.* distance d1 not exists (select 1 distance d2 d1."from" = d2."to" , d1."to" = d2."from" , d2."from" < d2."to" );
if there “duplicate”, query pick row "from" < "to"
.
Comments
Post a Comment