请帮我弄清楚这个。因此,我试图在表单的标签中显示具有相同值的记录数。

SELECT Status_ , COUNT(Status_) FROM ISSUANCE WHERE Status_ = 'Draft' GROUP BY Status_

我怎样才能展示它?谢谢您。
    Dim disconn As New SqlConnection("Server = EURIZZE-PC;Database = INTERTRANS;Integrated Security = SSPI;")
    Dim DataSet2 As New DataSet


    Dim sqlcon As String = "SELECT ISSUANCE.Status_ , COUNT(Status_) FROM ISSUANCE WHERE Status_ = 'Draft' GROUP BY Status_"
    Dim sqlda As New SqlDataAdapter(sql, thisConnection)

    da.Fill(DataSet1, "ISSUANCE")
    NameLabel1.DataBindings.Add("text", DataSet1, "") 'So I am having trouble on how to display it. Because the rowcount is not a permanent column.

最佳答案

可能用类似于

SELECT Status_ ,
SUM(CASE WHEN Status_ = 'Draft' THEN 1 ELSE 0 END) AS NewSum
FROM ISSUANCE
GROUP BY Status_;

关于sql - 在标签中显示具有相同值的行数,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34851408/

10-10 06:32