SELECT DISTINCT
removes duplicate rows across all projected columns
What changes
- Input
- projected rows
- Output or change
- deduplicated rows
Syntax at a glance
SELECT DISTINCT <select_list>
Work example
A result needs SELECT DISTINCT to state whether duplicate rows should remain.
Add two identical literal rows and compare the result. Remove DISTINCT if a join is creating duplicates that should be fixed at the source.
Check your work SELECT DISTINCT. The duplicate behavior for SELECT DISTINCT matches the requirement and does not hide a join-key problem.
Open Microsoft Learn for full syntax, permissions, and details for your version.