I'm looking for a query that counts all entries which have more than 1 entry. e.g.:
adrnr value datum
15 8.68 2021-08-29
10 16.4 2021-08-30
15 33.6 2021-08-30
16 125.98 2021-08-31
10 23.44 2021-08-31
18 19.87 2021-08-31
16 26.87 2021-09-01
10 10.0 2021-09-01
I came up with following query:
SELECT adrnr, COUNT(adrnr) as summe FROM tablename WHERE datum >= '2021-01-08 00:00:00.000'
AND datum <= '2021-31-08 23:59:59.999' group by adrnr having count(adrnr) > 1
I then get an answer:
adrnr summe
15 2
10 2
This is fine, but I want to get just one SUM of all entries, i.e.:
summe
4
How do I get this answer. And after that I want to get the the SUM of all values that depends on the same condition, i.e. 82.12 Any idea?
Regards Jens