>>So, for that parent, which child row (AddDate) do you want to grab?
>
>That would be the same we are deleting. So, the goal is to update the parent from Invoice.AddDate value, but just before we remove the child record. So, basically, we are trying to simulate in time the parent value as if the unnecessary child record would not have been created.
>
>As per verification, in the second line, it was supposed to be 1.
>
>
>SELECT InvoiceTemp.NoClient,InvoiceTemp.AddDate FROM InvoiceTemp
> WHERE InvoiceTemp.RowNumber=1 AND InvoiceTemp.NoStatus=7 AND
> EXISTS (SELECT InvoiceTemp.Numero FROM InvoiceTemp AS InvoiceTemp2
> WHERE InvoiceTemp2.RowNumber=2 AND InvoiceTemp2.NoStatus=7 AND InvoiceTemp.NoClient=InvoiceTemp2.NoClient)
>
>
>With that, it works.
If you want to delete multiple child rows per parent, which child's row would you like to use to update parent?
If it's not broken, fix it until it is.
My Blog