MySQL Forums
Forum List  »  Newbie

Re: First 'N' rows of each
Posted by: Bill Karwin
Date: October 19, 2006 02:28PM

SELECT t1.*
FROM `table` AS t1 LEFT OUTER JOIN `table` AS t2
  ON t1.`type` = t2.`type` AND t1.serialno >= t2.serialno
GROUP BY t1.serialno
HAVING COUNT(*) <= 2
ORDER BY t1.`type`

Regards,
Bill K.

Options: ReplyQuote


Subject
Written By
Posted
October 19, 2006 12:23PM
Re: First 'N' rows of each
October 19, 2006 02:28PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.