Hi All, I am trying to find the top 5 ee_entry id's, and then return
all rows matching any of the 5 ee_entry id's.  I think I am close, but
the following sql is currently only returning rows matching the first
ee_entry in the group_concat.  If I run the subquery separately and
manually create the sql replacing the subquery with it's result, I get
the intended result (all rows matching any of the 5 ee_entry).

SELECT dt,resource,resource_title,ee_entry,ee_author,ee_cat,ee_comment
FROM mint_visit
WHERE ee_entry
IN (
SELECT GROUP_CONCAT( ee_entry )
FROM (
SELECT ee_entry
FROM mint_visit
WHERE ee_entry >0
GROUP BY ee_entry
ORDER BY COUNT( * ) DESC
LIMIT 5
) AS t1
)
ORDER BY ee_entry DESC , dt ASC


I also tried:

SELECT dt, resource, resource_title, ee_entry, ee_author, ee_cat, ee_comment
FROM mint_visit
WHERE ee_entry
IN (
SELECT ee_entry
FROM mint_visit
WHERE ee_entry >0
GROUP BY ee_entry
ORDER BY COUNT( * ) DESC
LIMIT 5
)
ORDER BY ee_entry DESC , dt ASC

But I received an error:

#1235 - This version of MySQL doesn't yet support 'LIMIT &
IN/ALL/ANY/SOME subquery'


Thanks for your help,
Stephen

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to