Here is the code that I have tried to make a duplicate of the record with help of id
, by keeping the original record with one column value change. I have tried without the id
also, as it gets auto increment when inserting, but got errors like You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near
.
INSERT INTO
`org_emps`
(
3,
`admin_id`,
`emp_branch_id`,
`emp_name`,
'ITSe08A 0002',
`emp_designation`,
`emp_department`,
`emp_father_husband`,
`emp_mother`,
`emp_wife`,
`emp_nominee`,
'02-03-2018',
`emp_dob`,
`emp_gender`,
`emp_m_status`,
`emp_father_husband_dob`,
`emp_mother_dob`,
`emp_wife_dob`,
`emp_nominee_dob`,
`emp_aadhar`,
`emp_PAN`,
`emp_bank_ac_num`,
`emp_bank_ifsc`,
`emp_bnk_branch_address`,
`emp_pf_status`,
`emp_esi_status`,
`emp_income_tax`,
`emp_tds`,
`emp_photo`,
`emp_addr1`,
`emp_addr2`,
`emp_phone`,
`emp_email`,
`emp_w_off`,
`emp_ot_rate`,
'March 2, 2018, 8:46 am',
1,
`emp_key`
)
SELECT (
`id`,
`admin_id`,
`emp_branch_id`,
`emp_name`,
`emp_org_id`,
`emp_designation`,
`emp_department`,
`emp_father_husband`,
`emp_mother`,
`emp_wife`,
`emp_nominee`,
`emp_doj`,
`emp_dob`,
`emp_gender`,
`emp_m_status`,
`emp_father_husband_dob`,
`emp_mother_dob`,
`emp_wife_dob`,
`emp_nominee_dob`,
`emp_aadhar`,
`emp_PAN`,
`emp_bank_ac_num`,
`emp_bank_ifsc`,
`emp_bnk_branch_address`,
`emp_pf_status`,
`emp_esi_status`,
`emp_income_tax`,
`emp_tds`,
`emp_photo`,
`emp_addr1`,
`emp_addr2`,
`emp_phone`,
`emp_email`,
`emp_w_off`,
`emp_ot_rate`,
`emp_created_on`,
`emp_type`,
`emp_key`
)
FROM
`org_emps`
WHERE
id = 2