hai ive got two tables

company table

serial_no smallint(5) unsigned NO PRI NULL auto_increment
industry varchar(255)
company_name varchar(255)

person table

serial_no int(25)
company_name varchar(255)
contact_person varchar(255)

i want to insert the serial no in COMPANY to PERSON

i used the following code

INSERT INTO person(serial_no,company_name) 
SELECT company.`serial_no`,person.`company_name` 
FROM company,person 
WHERE person.`company_name`=company.`company_name`

there is some error pls help in fixing it

sorry company_name is already inserted in person table, thats why use update or else...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.