mysql积累
insert into t_ent_service(ent_id,service_id) select * from (select '1','2') as tmp
where not exists
(select 1 from t_ent_service where ent_id ='1' and service_id='2')
and
(select 1 from t_ent where ent_id = '1243434312')
and
(select 1 from t_service where service_id = '2325235235235256')
?
?
?
?insert?into?t_ent_service(ent_id,service_id,service_status,licence_num,service_exp_time,service_start_time,customized_patams)?
select?'1','2',1,20,'123',sysdate(),'备注信息'?from?dual
where?not?exists
(select?1?from?t_ent_service?where?ent_id?='1'?and?service_id='2')
and
(select?1?from?t_ent?where?ent_id?=?'1243434312')
and
(select?1?from?t_service?where?service_id?=?'2325235235235256')??
?
http://stackoverflow.com/questions/3164505/mysql-insert-record-if-not-exists-in-table
