Aggregating Data
Posted: Thu Feb 04, 2010 2:32 pm
I have 2 fields (id and name) such as
Id Name
1 abc
2 def
3 ghi
1 jkl
2 mno
3 pqr
1 stu
2 vwx
3 123
1 456
2 789
3 111
The above records should be grouped into multiple batches with max batch size 3 records. And the combination of id and batchno should be unique.
(Let's say I start my batch no.with 5 as below)
For example, my output should be as below.
Id Name BatchNo
1 abc 5
2 def 5
3 ghi 5
1 jkl 6
2 mno 6
3 pqr 6
1 stu 7
2 vwx 7
3 123 7
1 456 8
2 789 8
3 111 8
How do I achieve the batchno field result?
[/u]
Id Name
1 abc
2 def
3 ghi
1 jkl
2 mno
3 pqr
1 stu
2 vwx
3 123
1 456
2 789
3 111
The above records should be grouped into multiple batches with max batch size 3 records. And the combination of id and batchno should be unique.
(Let's say I start my batch no.with 5 as below)
For example, my output should be as below.
Id Name BatchNo
1 abc 5
2 def 5
3 ghi 5
1 jkl 6
2 mno 6
3 pqr 6
1 stu 7
2 vwx 7
3 123 7
1 456 8
2 789 8
3 111 8
How do I achieve the batchno field result?
[/u]