Here’s the solution with derived table
UPD: embed demo seems to not assign row IDs to new rows. In doc will actually work.