• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 154
  • Last Modified:

Count in SQL

How can I make this with SQL?


   Dim oBotas As New Botas
        oBotas.CargaDatos()
        Dim dtBotas As dsBotas.BotaDataTable = oBotas.DsBotas.Bota

        Dim dvMontar As New DataView(dtBotas)
        dvMontar.RowFilter = "Estado='Montar'"

        Dim dvMontada As New DataView(dtBotas)
        dvMontada.RowFilter = "Estado='Montada'"

        Dim dvLlenada As New DataView(dtBotas)
        dvLlenada.RowFilter = "Estado='Llenada'"

        Dim dvReparar As New DataView(dtBotas)
        dvReparar.RowFilter = "Estado='Reparar'"

        Dim dvVender As New DataView(dtBotas)
        dvVender.RowFilter = "Estado='Vender'"

        Dim dvVendida As New DataView(dtBotas)
        dvVendida.RowFilter = "Estado='Vendida'"

        Dim cntBotasParaMontar As Integer = dvMontar.Count
        Dim cntBotasMontada As Integer = dvMontada.Count
        Dim cntBotasReparar As Integer = dvReparar.Count
        Dim cntBotasVender As Integer = dvVender.Count
        Dim cntBotasLlenas As Integer = dvLlenada.Count
        Dim cntBotasVendidas As Integer = dvVendida.Count

        MsgBox("Montar: " & cntBotasParaMontar & Chr(13) & "Montadas: " & cntBotasMontada & Chr(13) & _
               "Reparar: " & cntBotasReparar & Chr(13) & "Vender: " & cntBotasVender & Chr(13) & _
               "Vendidas: " & cntBotasVendidas & Chr(13) & "Llenas: " & cntBotasLlenas)
0
miguelmam
Asked:
miguelmam
1 Solution
 
flavoCommented:
SELECT count(*) as myCount, [Estado]
FROM myTable
GROUP BY [Estado];


Should retrun

132   : Montar
4234 : Montada etc....

IDea?


Dave
0
 
miguelmamAuthor Commented:
Can you send me the whole complete code so that it works, included connection and Command?

Thank you
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now