我有两张桌子
*table1*
id(pk) name price
1 x1 y1
2 x2 y2
*table2*
id (fk) type(pk) title
1 t1 tit1
1 t2 tit2
2 t3 tit3
2 t4 tit4
2 t5 tit5
我喜欢加入表格,重复输入以获得结果:
*result*
id type title name price
1 t1 tit1 x1 y1
1 t2 tit2 x1 y1
2 t3 tit3 x2 y2
2 t4 tit4 x2 y2
5 t5 tit5 x2 y2
答案 0 :(得分:1)
select * from table1 inner join table2 on table1.id = table2.id
答案 1 :(得分:0)
简单的联接可以做到这一点......
select
*
from
table1
inner join table2 on table1.id = table2.id