>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.