Count in SQL

How can I make this with SQL?

   Dim oBotas As New Botas
        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)
Who is Participating?
flavoConnect With a Mentor Commented:
SELECT count(*) as myCount, [Estado]
FROM myTable
GROUP BY [Estado];

Should retrun

132   : Montar
4234 : Montada etc....


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

Thank you
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.