×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
My question is in the subject
Within SQL, what does distinct mean?
I always thought that it was a "glorified" group by, order by
For example:- Within an SQL query, I have created a work file (CTE) that has 7 fields
There are duplicate records within this CTE - which is valid, based upon how this data is collected
I want to cull this down to unique records - so I ended my SQL with the following
Select distinct Field1, Field2, Field3, Field4, Field5, Field6, Field7 from CTE
Thinking that the results would be a list of unique records
But it isn't.
I can see duplicate records
To remove these duplicates I have to insert the following SQL instead
Select Field1, Field2, Field3, Field4, Field5, Field6, Field7 from CTE
Group by Field1, Field2, Field3, Field4, Field5, Field6, Field7
Order by Field1, Field2, Field3, Field4, Field5, Field6, Field7
Is my understanding of distinct incorrect?
Am I using it wrong?
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.