这是一个创建于 4518 天前的主题,其中的信息可能已经有所发展或是发生改变。
需求是要从table1查出id1,然后从table2中根据id1查出对应的id2。
表的大概结构就是:
table1的字段:
id_ai,id1,name1,desc1
table2的字段:
id_ai,id1,id2
这样的需求能够用一句SQL就搞定么?
谢谢。
3 条回复 • 1970-01-01 08:00:00 +08:00
|
|
1
ri0day 2012-02-15 19:05:46 +08:00
join 也可以吧
|
|
|
2
reus 2012-02-15 19:15:55 +08:00 via Android
select id2 from table1 left join table2 on table1.id1=table2.id1 where .... 这样吧
|
|
|
3
icerunz 2012-02-15 20:07:09 +08:00
|