I am trying to select values from two tables and insert them into one table and calculate the number of placements in total per year. I keep getting an error saying sequence not allowed here
DROP table placement_cal CASCADE CONSTRAINTS;
CREATE TABLE placement_cal(
cal_id INTEGER NOT NULL,
year INTEGER,
no_of_placements INTEGER,
CONSTRAINT pk_cal_dim PRIMARY KEY (cal_id)
);
INSERT INTO placement_cal (
SELECT cal_id.nextval , EXTRACT(YEAR FROM start_date) , count(placement_id)
FROM placement
group by year);
INSERT INTO placement_cal (
SELECT cal_id.nextval , EXTRACT(YEAR FROM start_date) , count(placement_id)
FROM placement_two
group by year);
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…