I would like to randomly insert in a new temp_table the records from the Initial Table below, grouping them by a new PO number (1234-1, 1234-2,etc..) where each group sum(TK
It's probably a job for a cursor.
The algorithm could basically be like this:
sum(TKG)
and sum(TVOL)
:
But I'm too lazy at the moment to give out the actual code, besides it's a homework, and cursors hate me anyway.