I will like to insert into same table if the ip_address for the product_id wasn\'t exist but preferably not to create two separate query. How can I achieve it?
Below
You can test the solution in the SQL-Fiddle.
Below is the sample Insert statement.
insert into temp (select 2,101,'2.2.2.2' from dual where not exists (select * from Temp t where t.product_id = 101 and t.ip_address = '2.2.2.2'));