I need to insert a name and another's table id into a table. For example:
name = John
id = table2.id
The problem is I don't have this id value. I would have to take it from a Select an use it in an Insert at the same time I insert a common value, so that insert..select doesn't do exactly what i need.
That would be something like this:
INSERT INTO table1 (name, id2)VALUES('John', SELECT id FROM table2 WHERE name='t2name')
Is there anything that would do this???
Thanks a lot.
name = John
id = table2.id
The problem is I don't have this id value. I would have to take it from a Select an use it in an Insert at the same time I insert a common value, so that insert..select doesn't do exactly what i need.
That would be something like this:
INSERT INTO table1 (name, id2)VALUES('John', SELECT id FROM table2 WHERE name='t2name')
Is there anything that would do this???
Thanks a lot.