[xquery-talk] return only latest version of an item

A. Steven Anderson steve at asanderson.com
Thu May 14 15:18:40 PDT 2009


Greetings!

I've got a pretty complex xquery that returns only the latest version of all
items in a collection, but I know there has got to be a more efficient way
to do it.

A simplified example of the XML that I'm dealing with (i.e. not invented
here) is as follows:

<items>
   <item>
      <id>1</id>
      <name>item # 1</name>
      <version>1</version>
   </item>
   <item>
      <id>1</id>
      <name>item # 1</name>
      <version>2</version>
   </item>
   <item>
      <id>1</id>
      <name>item # 1</name>
      <version>3</version>
   </item>
   <item>
      <id>2</id>
      <name>item # 2</name>
      <version>1</version>
   </item>
   <item>
      <id>2</id>
      <name>item # 2</name>
      <version>2</version>
   </item>
   <item>
      <id>3</id>
      <name>item # 3</name>
      <version>1</version>
   </item>
</items>

What would be the most efficient way to do this?

Thanks in advance!

-- 
A. Steven Anderson
Independent Consultant
steve at asanderson.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20090514/caac92c0/attachment.htm


More information about the talk mailing list