I have two tables in SQL Server:
Now I want to select a certain set of ids and insert some entries into the prices-table with those ID.
e.g. (wrong and not working SQL)
INSERT INTO prices (group, id, price)
VALUES (7, (select articleId from article WHERE name LIKE 'ABC%'), 1.50);
SQL Error -> subquery has more than 1 value
You want:
insert into prices (group, id, price)
select
7, articleId, 1.50
from article where name like 'ABC%';
where you just hardcode the constant fields.