MySQL Forums
Forum List  »  Newbie

Re: Find Similar Entries - Return Entry and Number
Posted by: Felix Geerinckx
Date: April 28, 2005 01:33AM

brettlareau wrote:
> I have data in the form of random words, with some repeats.
> Can I write a query that will return the most frequently returned word and how many times it
> occured? I am just looking for a starting point...

USE test;
DROP TABLE IF EXISTS foo;
CREATE TABLE foo (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
word VARCHAR(20));

SELECT
word,
COUNT(word) AS cnt
FROM foo
GROUP BY word
ORDER BY cnt DESC;


> Also, will it be possible to return the next 4 records in order.

I don't understand what you mean by 'the next 4 records'.

--
felix

Options: ReplyQuote


Subject
Written By
Posted
Re: Find Similar Entries - Return Entry and Number
April 28, 2005 01:33AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.