I have an SQL query for my database to get the 5 most popular queries in my website.
SELECT query, COUNT( query ) AS cnt
FROM search_queries
GROUP BY query
ORDER BY cnt DESC
LIMIT 5
This works when I use it in phpmyadmin, and it shows my 5 most used queries. Now, I want to convert it to pure CakePHP format so I can include it in my website (using $this->find()). What is the easiest way to write it?
Thanks!