Consider a table with 2 fields:
tbl(Id int primary key,Name varchar(100))
Assume that this table contains one row with Id=3 and some unknown Name.
Id | Name
---------------
3 | *****
I have an array of Ids, for example: array(4,6,7,10)
How to put these Ids with the Name of row with Id=3 into this table with one query, So that the resulted table would be:
Id | Name
---------------
3 | *****
----------------
4 | *****
----------------
6 | *****
----------------
7 | *****
----------------
10 | *****
I can not use the Name's value in the query.
I am thinking of a query like this:
insert into tbl(Id,Name) select (4,6,7,10),Name from tbl