Categories
MySQL

SQL: selecting top N records per group

Based on a similar concept, combined with string walking, I now present a query which selects top-n records for each group, ordered by some condition. It will require no subqueries. It executes faster than its more conventional alternatives.

via SQL: selecting top N records per group | code.openark.org.