On 16 Jan 2016, at 2:31pm, R Smith <rsmith at rsweb.co.za> wrote: > There is of course no SQL function to do this, but thanks to CTE we can > achieve it easily (though not extremely efficiently).
I thought that WITH could be used only for SELECT statements. Oh wait, you want to use the WITH statement as a sub-select on an INSERT statement. Does that work ? Simon.