Reputation: 1
I am trying to INSERT INTO
a table using the input from another table. For example:
Table A
contains item and item description details but it has only till December 2021.
Table B
contains date values.
I need to copy only the date column from Table B
to Table A
and item details can be null for future dates.
I'm using the below format to insert the data
INSERT INTO TABLE A
( DATE
, CL 1
, CL 2
, CL 3
, CL 4
, CL 5)
SELECT date , 0,0,0,0,0
FROM TABLE B;
Expectation: Need to copy the date column from table B to table A for specific date range ie. between SYSDATE and APRIL 2023 As there is no primary key we cannot join these two tables.
Please suggest for a solution to copy the future dates from TABLE B
to TABLE A
without using the join .
Upvotes: 0
Views: 736
Reputation: 520908
Do you need a WHERE
clause here:
INSERT INTO TABLE A ("DATE", CL1, CL2, CL3, CL4, CL5)
SELECT "date", 0, 0, 0, 0, 0
FROM TABLE B
WHERE "date" >= SYSDATE AND "date" < date '2023-05-01';
Upvotes: 0