我是 VBA 的初学者。我设法在 VBA 中运行 mySQL 查询,但我在所有 excel 列结果中得到相同的数字。我不确定我应该在代码中更改什么以显示不同的结果。有人可以帮帮我吗?
strSql = "SELECT COUNT(*), destination_id FROM `order` " & _
"JOIN user ON user.id = order.destination_id " & _
"WHERE payment_status = 'pay' " & _
"AND email NOT LIKE '%@thelts.com' " & _
"AND email NOT LIKE '%trend.com' " & _
"AND `is_dinstinct` IS NULL; "
rs.Open strSql, oConn, adOpenDynamic, adLockPessimistic
res = rs.GetRows
rs.Close
Range("A1", "B6") = res(0, 0)