mysql - sql find and remove duplicate columns with trim -
i have table "partner_entries" 3 columns : our_ref | partner_ref | partner_tag
thoses 3 fields form primary key.
i have amount of "duplicate" rows :
42 | abc | tag1 42 | abc | tag1
as can see it's not duplicate because there space after same word. can retrieve duplicates based on our_ref , partner_tag :
select count(*) nb_duplicates, our_ref, partner_tag partners_entries group our_ref, partner_tag having count(*) > 1
but take rows partner_ref different, want select thoses partner_ref same space after, how can ?
thanks help
use trim in select , group clauses:
select count(*) nb_duplicates, our_ref, trim(both '\n' partner_ref), partner_tag partners_entries group our_ref, trim(both '\n' partner_ref), partner_tag having count(*) > 1
use extended trim syntax remove newlines , other symbols data
Comments
Post a Comment