By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,987 Members | 1,592 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,987 IT Pros & Developers. It's quick & easy.

limit 10 on mysql and equal values with the 10th record

P: 1
Hi group,
I use "LIMIT 10" in mysql query but what I really need is to get also all the equal with the 10th record values.
I know that ms access do it by default with "select top" but I can't make it to work in mysql.
Searching around I didn't manage to find any familiar issue...
Could you please help? Thank's
the query is

Expand|Select|Wrap|Line Numbers
  1. SELECT 
  2.         T_people.person AS person,
  3.         COUNT(ST_peoplefilms.ID_films) AS CountOfID_films
  4.     FROM
  5.         ((MT_films
  6.         JOIN ST_peoplefilms ON ((MT_films.ID_films = ST_peoplefilms.ID_films)))
  7.         JOIN T_people ON ((T_people.ID_person = ST_peoplefilms.ID_person)))
  8.     GROUP BY T_people.person , T_people.man , ST_peoplefilms.ID_idiotita , MT_films.kind_movie
  9.     HAVING ((T_people.man = 1)
  10.         AND (MT_films.kind_movie ='ShortFilm')
  11.         AND ((ST_peoplefilms.ID_idiotita = 2)
  12.         OR (ST_peoplefilms.ID_idiotita = 13)
  13.         OR (ST_peoplefilms.ID_idiotita = 40)
  14.         OR (ST_peoplefilms.ID_idiotita = 44)
  15.         OR (ST_peoplefilms.ID_idiotita = 45)))
  16.     ORDER BY COUNT(`ST_peoplefilms.ID_films) DESC
  17.     LIMIT 10
May 10 '16 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.