How to get the ID from the bulk inserted records

I wrote a suggestion how to solve this here: Sidestepping Retool's SQL Limitations