mysql Utwórz procedurę phpMyAdmin
delimiter //
CREATE PROCEDURE insert_user_temp()
BEGIN
DECLARE row_coun_no INT;
SELECT COUNT(`id`) INTO row_coun_no FROM user_temp;
IF row_coun_no != 0 THEN
TRUNCATE `user_data`;
INSERT INTO user_data (employee_id,employee_code,employment_type,`emp_name`,first_name,middle_name,last_name,photo_file_name,email_id)
SELECT employee_id,`employee_code`,`employment_type`,CONCAT(`first_name`," ",`last_name`),`first_name`,`middle_name`,`last_name`, `email_id`, `photo_file_name` FROM `user_temp`;
TRUNCATE user_temp;
UPDATE `demo_user`.`tbl_users`, `main_user`.`user_data` SET tbl_users.profile_pic = user_data.photo_file_name
WHERE tbl_users.email = user_data.email_id;
END IF;
END;//
delimiter ;
Elated Eagle