SQL怎么把两个不同表中的相同内容筛选出来
Private Sub insearch(ByVal sql As String)Set cn = New Connection
cn.CursorLocation = adUseClient
cn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\jxc.mdb;"
Set rs = New adodb.Recordset
rs.LockType = adLockOptimistic
If Len(Trim(sql)) <= 0 Then
rs.Open "select * from instore ", cn, adOpenDynamic
Else
rs.Open "select * from instore union select * from WSPdrawing where " & Trim(sql), cn, adOpenDynamic
End If
Set DataGrid1.DataSource = rs
End Sub
这上面的代码只能把表"WSPdrawing"中的筛选出来,而表"instore"中还是全都显示出来,但是如果上面只搜索一个表的话就可以筛选出来,为什么?