MySQL can you use LIMIT to return n rows, but then also return any other row whose value matches the nth row? -



MySQL can you use LIMIT to return n rows, but then also return any other row whose value matches the nth row? -

i trying limit number of rows returned top 5 rows after they've been ordered, need homecoming other rows share same value 5th top value.

i.e.

number of traffic tickets 8 7 7 6 4 4 4 3 2

should homecoming 8, 7, 7, 6, 4, 4, 4 because 4 5th value, , other 4's 'tied'.

is possible limit row in mysql?

select numtickets drivers order numtickets desc limit 5 ???;

is there can set in question marks accomplish in mysql?

there couple ways using subquery. uses in:

select numtickets drivers numtickets in ( select numtickets drivers order numtickets desc limit 5)

you utilize join:

select d.numtickets drivers d bring together ( select numtickets drivers order numtickets desc limit 5) d2 on d.numtickets = d2.numtickets

mysql limit

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -