Sqlserver
 sql >> Base de Dados >  >> RDS >> Sqlserver

Inserir com várias subconsultas como valores

insert into mytable (columns)
select somevalue, somevalue, a.id, b.id, c.id
from
 othertable1 a
 cross join othertable2 b
 cross join othertable3 c
where
 a ... condition
 b ... condition
 c ... condition