List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:November 3 2000 12:11am
Subject:Re: DISTINCT question
View as plain text  
>I have a database of files. In the database is information about the app
>that produced the file.
>
>I want to list the top 5 producers. If I do:
>
>distinct(Producer), count(*) as Documents from data where Producer is not
>null group by Producer order by Documents desc limit 5;
>
>This works, but it differentiates between 'PageMaker 6.0', 'PageMaker 5.0',
>etc. I want it to show the top 5 and if there are different versions, to
>collapse them.
>
>Any way to do this in MySQL?

Store the product name and version number in seprate fields.
-or-
Instead of selecting Producer, select SUBSTRING_INDEX(Producer, " ", 1).

>
>Thanks,
>
>Michael
>
>P.S. Please reply directly to me and not the list as I am not a subscriber
>to the list.


-- 
Paul DuBois, paul@stripped
Thread
query questionMichael O'Rourke20 Oct
  • Re: query questionBenjamin Pflugmann21 Oct
  • DISTINCT questionMichael O'Rourke3 Nov
    • Re: DISTINCT questionPaul DuBois3 Nov