INSERT WHEN NOT EXIST [message #681591] |
Thu, 06 August 2020 12:06  |
 |
deepakdot
Messages: 77 Registered: July 2015
|
Member |
|
|
Hello, I am trying to write a SQL. May be simple , but not getting a Right login. Here I am describing with a example.
One Employee may have multiple Dept no. DEPT will be an input ( lets say 20 )
CREATE TABLE T1 ( EMP VARCHAR(10), DEPT NUMBER (10));
EMP DEPT
---------
E1 10
E1 20
E2 10
E3 20
I want to insert to the same table T1, where any employee does not belongs to DEPT 20. Here only E2 does not belongs to 20. So it should insert one row with (E2,20);
INSERT INTO T1 SELECT * FROM T1 WHERE ... ?
Thanks
Deepak
|
|
|
|
|
|
|
|
|