![VB.NET源码-156个实用实例哦……](http://www.zhzx123.com/VB.NET_03.gif)
请教:数据库逆向查询问题
例如:
Student表:ID,Name
Detail表:ID,Sex,StudentID
Age表:ID,Age,DetailID
并建立了通过ID建立了两个外键约束
要搜索age= ''20 ''且Sex= ''女 ''的所有学生的姓名
有什么比较方便的方法么?
多谢
在线等
__________________________________________________________________________
你的Age表:ID,Age,DetailID中DetailID
最好改成 Studentid
不过你现在这样也可以查 不考虑SQL效率的话 select name from student where id in (select id from detailid where (sex= ''女 '') and id in (select Detailid from Age where Age= ''20 '') )
__________________________________________________________________________