Get n records grouped by a certain field

From: Sashi <>
Date: Fri, 11 Dec 2009 07:25:42 -0800 (PST)
Message-ID: <>

Hi all,

Let's say I have the canonical employee table. Let's say I have a dept_id field.
Let's say that there are 1000+ employees in each department.

Can it be done via sql that I need to see, say 10 employees from each department?

select emp_last_name, dept_id
from employee
(but only fetch 10 employees for each department and I do want all departments selected).

Hope that makes sense.

Sashi Received on Fri Dec 11 2009 - 09:25:42 CST

Original text of this message