Compare two columns for difference mark the difference in mysql

Posted on

Question :

I need to compare two fields and mark the similar fields in third table.

For Example:

Tables

customer:
  phone id,
  phonenumber
  followstatus

received_Customer:
  rc_id,
  rc_phonenumber.

I need to mark the fdnumber with f or n/a in follow up which is in received and customer table.

update customer 
select b.phonenumber 
from received_customer n 
join customer b 
on b.phonenumber = n.phonenumber 
SET followUpStatus= 'y' ;

I run query in php.

Answer :

That is not the correct syntax for an UPDATE+JOIN. Try the following (assuming it is what you want, updating the table customer):

UPDATE customer b
JOIN received_customer n 
ON b.phonenumber = n.phonenumber 
SET b.followUpStatus= 'y' ;

Leave a Reply

Your email address will not be published. Required fields are marked *