mysql - How can I update addressed id they look some what the same -
is there way try fix addressed in address column on database?
so if have 2 records 123 main rd 123 main road
i want make both same not matter 1 select long same?
is there possible way in mysql?
the table looks this
create table address ( id int(11), address1 varchar(255), account_id int(11) ); id -> address1 -> account_id 10 -> 123 main rd -> 65 20 -> 123 main road -> 65 25 -> 8751 west 1st street -> 65 27 -> 4521 11th ave -> 65
so want compare addresses share same account_id , not of them if have 10 records same account_id want compare 10 addresses against each other , not database.
it's wild guess if rows same account_id
should have same address can following
update address join ( select * address account_id = 65 order id desc limit 1 ) q on a.account_id = q.account_id set a.address1 = q.address1
here sqlfiddle
Comments
Post a Comment