I have a simple query that I want an average on. This is what it looks like now, and I want to know the average of my count per Opname_OpnameID.
SELECT Opname_OpnameID, count(*) as 'behandelingen per opname'
FROM behandeling
GROUP BY Opname_OpnameID
You can use
count(distinct)
and not use a subquery:If you want the average count, presumably over the entire table, then just do exactly that: