Project

Profile

Help

How to connect?
Download (370 Bytes) Statistics
| Branch: | Revision:

he / src / use-cases / r / q14.xq @ a31dd97a

1
<result>
2
 {
3
    for $i in distinct-values(doc("bids.xml")//itemno)
4
    let $b := doc("bids.xml")//bid_tuple[itemno = $i]
5
    let $avgbid := avg($b/bid)
6
    where count($b) >= 3
7
    order by $avgbid descending
8
    return
9
        <popular_item>
10
            <itemno>{ $i }</itemno>
11
            <avgbid>{ $avgbid }</avgbid>
12
        </popular_item>
13
  }
14
</result>
(16-16/42)