I have 2 table, first I retrieve all Ids like this:
select DISTINCT entity_id From table1 I want to create a bulk insert using entity_id and prevent duplicate if the entity_id have a specifique value in the colomn2:
example
********************************************* * ID * ENTITY_ID * COLOMN2 * value * ********************************************* * 1 * 230 * 20 * 1 * * 2 * 230 * 100 * 1 * * 3 * 280 * 20 * 0 * * 4 * 220 * 20 * 1 * ********************************************* select DISTINCT entity_id From table1 // return : 230,280,220 INSERT into table1 ('ENTITY_ID','COLOMN2','VALUE') VALUES([the select id],100,1) WHERE COLOMN2<>100 or something like that?
the result need to be:
creating 2 insert... entity_id=220 and entity_id=280
with the colomn2=100 and value = 1
any idea ?