XQuery - group by and count

ScootaNof

New Member
This is the structure of my XML file -\[code\]<A> <Name t="Mr.">James Bond</Name> <Name t="Mr.">Allen Bond</Name> <Name t="Mr." p="X">James Bond</Name> <Name t="Mr." p="X">James Bond</Name> <Name t="Mr.">James Bond</Name> <Name t="Mrs.">James Bond</Name> <Name t="Mrs.">James Bond</Name> <Name t="Mr.">James Bond</Name> <Name t="Mrs." p="Y">James Bond</Name> <Name t="Mrs." p="Y">James Bond</Name></A>\[/code\]The output I am expecting is - \[code\]<A> <N>Allen Bond Mr - 1</N> <N>James Bond Mr - 3</N> <N>James Bond Mr, X - 2</N> <N>James Bond Mrs - 2</N> <N>James Bond Mrs, Y - 2</N></A>\[/code\]I am able to get the distinct names but cant add the count...
 
Back
Top