I have an insert into statement and this statement will have a sub query where it gets all its information from. I just have one problem I have to use an primary key index which I created as a sequence. I just don't know how to insert a sequence with a sub query. Any help would be much appreciated. At the moment the insert into statement is not working but this is what I have so far.
INSERT INTO data_plan_demand(data_demand_id, data_plan_name,product_demand,data_plan_inf)
VALUES( seq_data_demand_id2.nextval ,
(SELECT d.name, COUNT(u.data_id) AS product_demands,
d.information AS dataplan_information
FROM users u, data_plans d
WHERE u.data_id = d.data_plan_id
GROUP BY d.name,d.information));