Db.Execute "delete from B " & _ 
          " where KH='" & fg.TextMatrix(i, 2) & "' " & _ 
          "  and dttime between (select min(dttime1) from A where KH='" & fg.TextMatrix(i, 2) & "' and dttime2 = #" & fg.TextMatrix(i, 1) & "#) " & _ 
          "                  and (select max(dttime2) from A where KH='" & fg.TextMatrix(i, 2) & "' and dttime2 = #" & fg.TextMatrix(i, 1) & "#) " 在SQL数据库下怎么改?

解决方案 »

  1.   

    sql没有用过,应该日期修改一下,这样Db.Execute "delete from B " & _ 
              " where KH='" & fg.TextMatrix(i, 2) & "' " & _ 
              "  and dttime between (select min(dttime1) from A where KH='" & fg.TextMatrix(i, 2) & "' and dttime2 = '" & fg.TextMatrix(i, 1) & "') " & _ 
              "                  and (select max(dttime2) from A where KH='" & fg.TextMatrix(i, 2) & "' and dttime2 = '" & fg.TextMatrix(i, 1) & "') "