I have a database 'test' with a table 'Allgemein. This table has hundreds of entries.
The columns are 'Datum_Aufzeichnung', 'Uhrzeit', 'Druck' and 'Anschluesse'.
I want to find the sum of the column 'Druck' in the time from '170402' to '170403'.
This is still possible for me with
Test = sql_SchlafGut.ExecQuerySingleResult("SELECT sum(Druck) FROM Allgemein where Datum_Aufzeichnung <= 170403 and Datum_Aufzeichnung >= 170402 order by Datum_Aufzeichnung ASC")
The result from the attached DB is 1507.
However, because the record_date is partially present in the table, my result does not match. The number of 'Druck' for 'Aufzeichnungs_Datum' can only be counted once. The result must be 501.
That means I have to use DISTINCT at the record_date.
Here I am with my Latin at the end and hope to get an SQL expert the solution.
The columns are 'Datum_Aufzeichnung', 'Uhrzeit', 'Druck' and 'Anschluesse'.
I want to find the sum of the column 'Druck' in the time from '170402' to '170403'.
This is still possible for me with
Test = sql_SchlafGut.ExecQuerySingleResult("SELECT sum(Druck) FROM Allgemein where Datum_Aufzeichnung <= 170403 and Datum_Aufzeichnung >= 170402 order by Datum_Aufzeichnung ASC")
The result from the attached DB is 1507.
However, because the record_date is partially present in the table, my result does not match. The number of 'Druck' for 'Aufzeichnungs_Datum' can only be counted once. The result must be 501.
That means I have to use DISTINCT at the record_date.
Here I am with my Latin at the end and hope to get an SQL expert the solution.