用Replace into 如果有替换。没有就插入
可以写一个简短的SQL例子吗?
@技术控甄:
REPLACE INTO hr_salary_stardard
(emp_id,emp_sn,dept_id,emp_type,proto_id,detail_id,credit_no,bank_name,bank_space,dept_type,base_salary,base_postsub,base_performance,base_specialsub,s_year,s_month)
SELECT
e.emp_id,
e.emp_sn,
e.emp_dept AS dept_id,
e.emp_type,
e.emp_title_proto AS proto_id,
e.detail_id,
e.pay_card AS credit_no,
e.pay_card_hom AS bank_name,
e.pay_card_hom_name AS bank_space,
d.dept_type,
salb.base_salary,
salb.base_postsub,
salb.base_performance,
salb.base_specialsub,
YEAR(NOW()-INTERVAL 1 MONTH),
MONTH(NOW()-INTERVAL 1 MONTH)
FROM hr_salary_base salb where 1=1
@cenlo: 学习了