Yes my fault, I should have compiled my original question better, my apologies.
So for each row of data there is this XML column and a REF_NO column. Each REF_NO will have it's own unique XML based on Country/Region. At the moment, your original code gives me all XML values in this column for each record, rather than for each unique REF_NO.
So for example, I am looking for something like:-
1234...FRANCE, ITALY.....EMEA, EMEA
1235...UK, SPAIN.....UK-IE, EMEA
Your revised code runs for a while but produces NULL values.
Thanks for your help, it has given me a great insight and good footing to see if I can resolve this.