Michael Katz
asked on
Top 3 records in sql server by group
item whse lot qty NumericDate
x 1 sdf 200 20141104
x 1 qwe 20 20141103
x 1 4rff 210 20141104
x 1 uyh 220 20141104
y 1 sdf 201 20141101
y 1 fgh 202 20141104
y 1 0de 203 20141104
y 1 90o 204 20141105
The answer that I need is to grab the top 3 records per Item, per Warehouse by NumericDate
if their is a tie...then the alphanumeric asc value of the lot that occurs first..
So a total of 6 rows to return...
Hopefully this I doable
x 1 sdf 200 20141104
x 1 qwe 20 20141103
x 1 4rff 210 20141104
x 1 uyh 220 20141104
y 1 sdf 201 20141101
y 1 fgh 202 20141104
y 1 0de 203 20141104
y 1 90o 204 20141105
The answer that I need is to grab the top 3 records per Item, per Warehouse by NumericDate
if their is a tie...then the alphanumeric asc value of the lot that occurs first..
So a total of 6 rows to return...
Hopefully this I doable
ASKER
yes ...That is what I mean...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Koen,
Very well done
Very well done
item whse lot qty NumericDate
x 1 sdf 200 20141104
x 1 qwe 20 20141103
x 1 4rff 210 20141104
y 1 sdf 201 20141101
y 1 fgh 202 20141104
y 1 0de 203 20141104
^--- top 3 from each group?