I have 2 tables, each with an identifying column. What I want to do is populate a new 2-column table with those identities so that it results in a pair of identities.
Now, I am able to completely populate with a column of my new table, identify any one of the tables, but other table can not be identified in my new table if it is the most Not a good first step, please let me know
Thanks
You can try something like the following:
select T3 (id, value_1, value_2) in IN3 t1.id, t1.value, t2.value FROM t1 join T2 ON (T2ID = T1 .ID); Test case (MySQL):
create table T1 (id int, value int); Create table T2 (id int, value int); Create table T3 (id int, value_1 int, value_2 int); Insert T1 value (1, 100); Insert T1 value (2, 200); Insert T1 value (3, 300); Enter the T2 values (1, 10); Insert T2 value (2, 20); Insert T2 value (3, 30); Result:
SELECT * FROM t3; + ------ + --------- + --------- + | ID | Value_1 | Value_2 | + ------ + --------- + --------- + | 1 | 100 | 10 | | 2 | 200 | 20 | | 3 | 300 30 | + ------ + --------- + --------- + 3 lines set (0.00 seconds)
Comments
Post a Comment