|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] return only latest version of an itemA. Steven Anderson steve at asanderson.comThu May 14 19:17:08 PDT 2009
> > Which must be a bug. saxon returns a different result. > Perhaps, or I've lost something in translation from my simplified example. > Using distinct-values to group by id could be another option, though maybe > not the fastest: > > for $id in distinct-values(/items//id) > let $itemsById := /items/item[id = $id] > return > $itemsById[version = max($itemsById/version)] > > You should have an index on id and version in any case. > This worked! It's twice as fast as my original convoluted solution. Many thanks to all who responded!! -- A. Steven Anderson Independent Consultant http://x-query.com/mailman/listinfo/talk -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090514/185cb630/attachment.htm
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






