Torna al Thread
Dim sSQL_Count As String = "SELECT " & _
"COUNT(Vendite.Quantita) AS Num_Tot, " & _
"SUM(Vendite.Quantita) AS Result_Sum " & _
"FROM Vendite " & _
"LEFT JOIN Clienti ON Vendite.ID_Cliente=Clienti.ID_Cliente " & _
"LEFT JOIN Segmenti ON Clienti.ID_Segmento=Segmenti.ID_Segmento " & _
"LEFT JOIN Agenti ON Vendite.ID_Agente=Agenti.ID_Agente " & _
"LEFT JOIN Articoli ON Vendite.ID_Articolo=Articoli.ID_Articolo " & _
"LEFT JOIN Categorie ON Vendite.ID_Categoria=Categorie.ID_Categoria " & _
"WHERE ID_Vendite >0 " & _
"" & _EXTEND_ & " " & _
"ORDER BY Vendite.Firma_Contratto DESC "
TextBox1.Text = sSQL_Count 'mi serve per vedere la query e poterle copiare nel mySQL-Front per il test...
oConn.Open()
Dim oComm_1 As New OleDbCommand(sSQL_Count, oConn)
Dim oRead_1 As OleDbDataReader = oComm_1.ExecuteReader
oRead_1.Read()
n = oRead_1("Num_Tot").ToString
QuantitaTot = oRead_1("Result_Sum").ToString
oConn.Close()