发布网友
共4个回答
热心网友
select id from 表2 a
where exists (select 1 from 表1 where name=a.name)
热心网友
假设你的表头都是:id,name,weight,height
表名是 table1,table2
select table2.id from table2 inner join table1 on table1.name=table2.name
热心网友
数据库问题一定要给表结构,否则别人很难回答你
假定表结构为
表1
name 代表张三那一列
表2
id代表1,2,3那一列
name代表张三 李四那一列,
下面这个可以满足你的要求
SELECT id
FROM 表2 t
where exists (select 1 from 表1 where name = t.name)
热心网友
select table.ID
from table1 inner join table2 on table1.name = table2.name