Need help to Count from Mysql Please

sigster

Member
Joined
Feb 7, 2010
Messages
12
Programming Experience
Beginner
Hi hope someone can help me with this Please I have Mysql Database and need to get Report

Field

Company
town
Contractor

VB.NET:
I am count from the Mysql Database  to day like this

  Dim rs As New ADODB.Recordset()
  rs = New ADODB.Recordset()

  Dim dtStart As String = Date_start.Value.ToString("yyyy-MM-dd")
  Dim dtEnd As String = date_end.Value.ToString("yyyy-MM-dd")



ElseIf Cbo_select.Text = "Count Company" Then
rs.Open("SELECT Company, Count(*) AS CodeNameCount FROM names  WHERE date between '" & dtStart & "' and '" & dtEnd & "' GROUP BY Company", conn) 

End If



Do While Not rs.EOF
Dim item As New ListViewItem("")
ElseIf Cbo_select.Text = "Count Company" Then

                item.SubItems.Add(rs("Company").Value)
                item.SubItems.Add(rs("CodeNameCount").Value)

      Listview.Items.Add(item)
      rs.MoveNext()
  Loop
  rs.Close()


So I get the Company and number of data I have on the company into Listview
Company 1 = 30
Company 2 = 25




But I know need to count like this get more details but need little help with this Please


Sample

Company 1

Town 1
Contractor 1 = 30
Contractor 2 = 25
Town 2
Contractor 1 = 5
Contractor 2 = 8
Town 3
Contractor 1 = 22
Contractor 2 = 67
 
Back
Top