同一个数据库里2个表怎么连接

来源:百度知道 编辑:UC知道 时间:2024/07/06 00:46:31
比如2个表里有有"nr"字段。查询这个字段!谢谢!

使用连接或子查询
连接例:
对t表与y表基于"nr"字段进行连接
select *
from t join y
on t.nr=y.nr
子查询例:
select *
from t where ur in(select ur from y)

第三种( 完全对应连接):
select a.*,b.* from 表1 a ,表2 b
where a.nr=b.nr