-- table2 的 name 作为 table1的条件select * from table1 where name in (select name from table2)--如果有多条语句,可以使用字段相加再等于select * from table1 where fld1+fld2 in (select fld1+fld2 from table2)--也可以使用INNER JOIN 进行查询select a.* from table1 a inner join (select name from table2 group by name) b on a.name=b.name
本文介绍如何在SQL中使用子查询进行数据筛选,包括使用IN关键字与子查询结合、字段相加后再进行比较的方法,以及通过INNER JOIN实现表间的数据联接。
23万+





