Hi,
I have a SQL query that looks like this:
SELECT department, count(distinct person_id) AS NumberOfPersons
FROM person
GROUP BY department
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?
Manas TripathiPosted Mar 23, 2018, 12:31 AM
Joseph ThomasPosted Mar 22, 2018, 2:22 AM
Hakan AxheimPosted Mar 21, 2018, 4:18 AM
Manish KumarPosted Mar 21, 2018, 3:07 AM
Hakan AxheimPosted Mar 21, 2018, 12:17 AM
Manas TripathiPosted Mar 20, 2018, 7:30 PM