where count sql statement
===

I have stored count(ProductQuantity) into a list. As each ProductID have different count(ProductQuantity), i am trying to retrieve the ProductID based on the count(ProductQuanity).

      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() is the method to store the count(ProductQuanity)

What is the correct sql statement to retrieve the productid based on the count(ProductQuantity)