TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Hakan Axheim
NA
201
32.4k
Get RID of DISTINCT in SELECT
Mar 20 2018 4:14 PM
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?
Reply
Answers (
6
)
I have one doubt for SSIS please help me SSIS experts
Merge Statement