-1
Guys I’m having a little problem I have the following situation:
- table
escritorio
where I have a field calledid
that I’m gonna need - table
etapas
where I have the fieldsid
that I’m gonna need;
I need to popular a table called etapasemuso
where it has the following structure:
etapasemuso
emusoid int,
etapasid int,
escritorioid int,
ativo char(1),
etapaok char(1)
To popular this table above I need to search for data in the table escritorio
and stages, but I can not connect the same since there is no key between them. Would anyone know how to set up a query for popular that table above?
But if there is no link between the two tables how do you intend to combine the data of the two? Want to make a simple Cartesian product, this is each office table entry combined with all existing entries in the table steps? This makes sense?
– anonimo
Exact all office entries combined with steps
– Eder Luca
There doesn’t need to be a key to be making a Join between tables, now if they don’t a common field is going to be impossible, it’s like you want to link a table of "people" with a table of "minerals on Mars", it’s not possible to relate, and it wouldn’t make sense. In this case, it will be a Cartesian as @anonimo mentioned, then just put the two tables in the
from
and be happy (or not) ;)– Ricardo Pontual
something like
select escritorio.id, etapas.id from escritorio, etapas
– Ricardo Pontual
Use a CROSS JOIN, it would be something like: INSERT INTO etapasemuso(etapasid, office) SELECT steps.id, office.id FROM steps, office; .
– anonimo
Both Cross Join with select above solved my problem thanks for helping one more to collect that cross Join hugs everyone
– Eder Luca