This is a discussion on Cannot use sub queries in not exists.. within the Informix forums, part of the Database Server Software category; --> i try to do the following: insert into table select * from temp_table where name='BoB' and not exists (select ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| i try to do the following: insert into table select * from temp_table where name='BoB' and not exists (select * from table where name='BoB'); this always gives me back the error: SQL Error (-360): Cannot modify table or view used in subquery.. what do i do?? all I want is a condition so that i won't insert the same row that is already there.. |
| |||
| <pookguy88@gmail.com> wrote: > i try to do the following: > insert into table select * from temp_table where name='BoB' and not > exists (select * from table where name='BoB'); > > this always gives me back the error: > SQL Error (-360): Cannot modify table or view used in subquery.. > > what do i do?? > all I want is a condition so that i won't insert the same row that is > already there.. Would this get you what you want? INSERT INTO tab1 SELECT * FROM tab2 WHERE name NOT IN (SELECT name FROM tab1); -- June Hunt |
| ||||
| If it does not help. make two steps: 1. First make a temporary table 2. Insert from this table pookguy88@gmail.com schrieb: > i try to do the following: > insert into table select * from temp_table where name='BoB' and not > exists (select * from table where name='BoB'); > > this always gives me back the error: > SQL Error (-360): Cannot modify table or view used in subquery.. > > what do i do?? > all I want is a condition so that i won't insert the same row that is > already there.. > |