Hi,
I have a SQL query that looks like this:
SELECT department, count(distinct person_id) AS NumberOfPersons
FROM person
GROUP BY department
This query wil show me how many persons that are employed on departments. A person with same person_id can exist on several records in the person table therefore I have used distinct before count.
Because of performance issue I did not want to use DISTINCT!
How can I rewrite this SQL whith no DISTINCT in the SELECT statement?