Subject Re: [firebird-support] Inserting/Updating new records with data from previous records
Author Alan J Davies
Thanks Maya, it was a lot more complicated that that. I ended up
creating a GTT plus a main SP for selecting the delivery notes required
and calling a second Create SP for inserting into the GTT, then a third
Clone SP for replicating that data - one record for each label, then
another Update SP for calculating the no of boxes on each label.

Alan J Davies
Aldis


On 27/03/2017 06:18, Maya Opperman maya@...
[firebird-support] wrote:
>
>
>>Alan Wrote:
>>Partno, del_qty no_boxes, (pallet_qty, qty_per_box - do not vary for
> each part)
>>ABC 200 10 300 20
>>ABC 200 10 300 20
>>ABC 100 5 300 20
>
>>So far so good, but some of their customers require a second barcode
> label attached to the outer pallet (the 300 above)
>
>>I need to produce 2 pallet labels as follows:
>>Partno, del_qty no_boxes
>>ABC 300 15
>>ABC 200 10
>
> You will need a field to say which pallet the items are in, for example
> palletno.
>
> Then,
>
> select
> partno, palletno, sum(del_qty), sum(no_boxes)
> from yourTable
> group by partno, palletno
>
>
> -Maya
>
>