vb access 联合查询语句怎么写?
min1 = "SELECT min([PL1(G)]) FROM (SELECT * from MeaProto where [PL1(G)] <> 0 and [yy-mm-dd] between " & "'" & d1 & "'" & " and " & "'" & d2 & "'" & ")"
min2 = "select min([PL1(DEG)]) from (SELECT * from MeaProto where [PL1(DEG)] <> 0 and [yy-mm-dd] between " & "'" & d1 & "'" & " and " & "'" & d2 & "'" & ")"
min3 = "SELECT min([PL2(G)]) FROM (SELECT * from MeaProto where [PL2(G)] <> 0 and [yy-mm-dd] between " & "'" & d1 & "'" & " and " & "'" & d2 & "'" & ")"
min4 = "select min([PL2(DEG)]) from (SELECT * from MeaProto where [PL2(DEG)] <> 0 and [yy-mm-dd] between " & "'" & d1 & "'" & " and " & "'" & d2 & "'" & ")"
一张表,怎么实现联合查询,min1到min4写在一起
[解决办法]
strMin = min1 & " UNION " & min2 & " UNION " & min3 & " UNION " & min4
[解决办法]
按你的情况没必要联合,4个分开写就是了
min1
rst.open min1
minPL1_G = rst.Fields("minpl1").Value
rst.close
min2
rst.open min2
minPL1_GED = rst.Fields("minpl1g").Value
rst.close