count(ProductQuantity) をリストに保存しました。ProductID ごとにカウント (ProductQuantity) が異なるため、カウント (ProductQuanity) に基づいて 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() は count(ProductQuanity) を格納するメソッドです
count(ProductQuantity) に基づいて productid を取得するための正しい SQL ステートメントは何ですか?