At 15:56 +0000 2/1/02, SED wrote: >Hi, > >I'm trying to make a query where I select something distinct ordered by >most frequent? > >I found below example from the manual but I can not figure out how I >should order them by most frequent - do you know how? > > SELECT DISTINCT owner FROM pet
Don't use distinct in that case. Count them and order by the descending counts. SELECT owner, COUNT(owner) AS frequency FROM pet ORDER BY frequency DESC; > >Regards, >SED --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php