gpt4 book ai didi

sql - 在标签中显示具有相同值的行数

转载 作者:搜寻专家 更新时间:2023-10-30 23:00:02 31 4
gpt4 key购买 nike

请帮我解决这个问题。所以我试图将具有相同值的记录数显示到我表单的标签中。

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.

最佳答案

可能用 case 表达式更改您的查询

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/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com