mysql - Recombine link between element -
i have simple thing do, recombine 2 elements in table names, based on link.
create table element ( id int(11) not null auto_increment, text varchar(100) not null ); create table link ( elem_1_id int(11) not null, elem_2_id int(11) not null );
i want have text of both elements in link :
after :
insert element (text) values ('door'); insert element (text) values ('key');
door = id 1, key = id 2 and
insert link (elem_1_id,elem_2_id) values (1,2);
how can use select have :
| door | key |
able :
select e1.text, e2.text link, element e1 inner join element e2 link.elem_1_id=e1.id , link.elem_2_id=e2.id;
Comments
Post a Comment