Text after "
I want to group them down randomly by entering a new temp_table record from the initial table, with a new PO number (1234-1, 1234-2, etc ..) where the sum of each group (TKG) & lt; 20 more zodiac (TVOL) & lt; 0.1
Initial table lineID PO item quantity load Volume T.KG T.VOL 1 1234 ABCD 12 04040,0030 480,036 2 1234 EFGH 8 03939000000 3 , 12 0,040 3 1234 IJKL 5 0,48 0,0070 2,40 0,035 4 1234 MNOP 8 0,69 0,0040 5,53 0,032 5 1234 QRST 9,58 0,0025 5,22 0,023 6 1234 UVWX 7 0.87 0.0087 6.09 0.061 7 1234 YZAB 10 0,71 0,0064 7,10,064 8 1234 CDEF 6 0,69 0,0054 4,14,0,032 91234 GHIJ 7 0,65 0,0036 4,55 0,025 10 1234 KLMN 9 0.67 0.0040 6.03 0.036 The new Temp_Table should look like: LineID PO item quantity weight volume TKG T.VOL 1 1234-1 ABCD 12 040,0,0030 480 0,036 2 1234-1 EFGH 8 039 0,0050 3, 12 0,040 5 1234-1 QRST 9,58 0,0025 5,22 0,023 3 1234-2 IJKL 5 0,48 0,0070 2,40 0,035 4 1234-2 MNOP 8 0.69 0.0040 5.53 0.032 8 1234-2 CDEF6 0 0.69 0.0054 4.14 0.032 6 1234-3 UVWX 7,87,07,7 6 6, 09,061 10 1234-3 KLMN 9 0,67 0,0040 6,03 0,036 91234-4 GHIJ 7 0,65 0,0036 4,55 0,025 7 1234-4 YZAB 10 0.71 0.0064 7.10 0.064
This is probably a cursor for a job.
The algorithm can basically be like this:
- Collect the rows together from the initial table,
the deposit amount (TKG) And sum (TVOL) : - Though still in temporary status (except those two, leave them);
-
-
-
-
-
- Continue even when the rows are not collected.
But I'm starting again, still to give out the lazy real code, maybe it's a homework, and the cursor hates me as well.
Comments
Post a Comment