我已将 count(ProductQuantity) 存储到列表中。由于每个 ProductID 都有不同的计数(ProductQuantity),我试图根据计数(ProductQuantity)检索 ProductID。
For Each i In sumofpquantity()
Dim sq As String = "SELECT ProductID From OrderDetail Where COUNT(ProductQuantity)= " & i & ""
Dim cmd2 As SqlCommand = New SqlCommand(sq, connection12)
Dim reading As SqlDataReader = cmd2.ExecuteReader()
While reading.Read()
list.Add(reading.GetInt32(reading.GetOrdinal("ProductID")))
End While
reading.Close()
Next i
sumofpquantity() 是存储计数的方法(ProductQuanity)
根据计数(ProductQuantity)检索productid的正确sql语句是什么