AlfieGoat
AlfieGoat
KKysely
Created by AlfieGoat on 5/8/2023 in #help
Noob Question: SQL INSERT that combines static values with a SELECT statement
Hey Kysely community! I'm just getting into Kysely and I have a question about how I could run the following query with Kysely:
INSERT INTO employees (employee_id, first_name, last_name, department_id)
VALUES (1234, 'John', 'Doe',
(SELECT department_id
FROM departments
WHERE department_name = 'Sales')
);
INSERT INTO employees (employee_id, first_name, last_name, department_id)
VALUES (1234, 'John', 'Doe',
(SELECT department_id
FROM departments
WHERE department_name = 'Sales')
);
I could get an INSERT + SELECT query to work, but wasn't sure how to add static values into the mix. Thanks in advance : )
6 replies