select * from table2
where
exists(select * from table1
where
table1.filed1 = 1 and table2.filed1 = table1.field0 and
table1.filed1 = 2 and table2.filed2 = table1.field0 and
table1.filed1 = 3 and table2.filed3 = table1.field0
)
where
exists(select * from table1
where
table1.filed1 = 1 and table2.filed1 = table1.field0 and
table1.filed1 = 2 and table2.filed2 = table1.field0 and
table1.filed1 = 3 and table2.filed3 = table1.field0
)
解决方案 »
- Conn As New ADODB.Connection 与 Conn As String 两种执行有什么区别?
- VB中move方法的问题
- 如何用vb代码实现光盘浏览的功能
- 如何使用Ado的Shape命令
- 在三层架构中怎么传窗体某控件的值?
- 要求置顶---强烈要求大家找一个公用的ftp
- VB输出EXCEL报表的几个问题!急!在线等!
- 有关集合与子集合初始化的问题,请高手帮忙!!
- VB与VBA之区别与联系?
- 怎样用WINSOCK广播 在局域网?那里有VB的IPX(游戏里常用的协议,如星际)编程资料
- Dictionary类型怎么使用呀?
- 刚才可能是我说的不清楚,我重写一遍,请大家看仔细了,谢谢帮忙.
or (table1.field(1)=2 and field(0)=table2.field(2))
or (table1.field(1)=3 and field(0)=table2.field(3))
select * from table2
where
exists(select * from table1
where
table1.filed1 = 1 and table2.filed1 = table1.field0 or
table1.filed1 = 2 and table2.filed2 = table1.field0 or
table1.filed1 = 3 and table2.filed3 = table1.field0
)
其他的先不探讨,但这两个AND一定要改成OR
是不是应该这样
select * from table2
where
exists(select * from table1
where
(table1.filed1 = 1 and table2.filed1 = table1.field0) or
(table1.filed1 = 2 and table2.filed2 = table1.field0) or
(table1.filed1 = 3 and table2.filed3 = table1.field0)
)
http://www.csdn.net/expert/topic/461/461023.shtm