Distinct

Space Cowboy

Member
Local time
Today, 06:19
Joined
May 19, 2024
Messages
245
I have used DISTINCT in the sql straight after select. However the search is not showing sales of the same item price when I only wanted distinct order dates.
Can DISTINCT be applied to certain fields only?
 
Distinct is much the same as a group by clause and can be applied to any field except perhaps long text. What is your sql as it is not clear what the issue actually is. Perhaps provide an example of the data, the outcome required and what you are actually getting from that example data

I suspect you are including fields that are not distinct
 
SELECT DISTINCT and then a field list.
can I apply to only a certain field?
 
SELECT DISTINCT and then a field list.
can I apply to only a certain field?
Unfortunately, the information needed to offer details suggestions lies buried in the phrase, "a field list".

Are ALL of the values in all of the fields in that field list Distinct? Or are you looking for Distinct values in only one or two of the fields out of the entire list?
 
I am looking for Distinct values in only one of the lists
Then you need a query with only ONE of the fields. Distinct refers to the entire list of selected fields, not to any particular field. If you select three columns and if the combination of all three is different in any row, that row is selected
 
Thanks a lot guys, I understand what is going on now with the operator.
Sorry for being a PITA.
I needed to add more data to the query to stop it removing duplicates that I wanted to keep
 

Users who are viewing this thread

Back
Top Bottom