W3C home > Mailing lists > Public > public-qt-comments@w3.org > February 2004

ORA-XQ-407-B: distinct values of multiple sequences should be possible

From: Stephen Buxton <Stephen.Buxton@oracle.com>
Date: 20 Feb 04 10:07:37
Message-Id: <200402201807.i1KI7cb21840@rgmgw4.us.oracle.com>
To: public-qt-comments@w3.org
Cc:

SECTION G.5: Selecting distinct combinations

Today, the distinct-values takes a single sequence as input and returns a sequence of distinct values. This makes it quite cumbersome to perform distinct values across a tuple.

 It is trivial in SQL for example to perform a distinct across values - 

select DISTINCT price, orderno, date
from table;

 With XQuery, one has to get distinct prices, ordernos and dates and then somehow combine them back with the original node. This is both cumbersome and harder to optimize in a general query. 

Suggestions:
i) If we have a sequence of tuples or sequence of sequences, then distinct values can take in a sequence of tuples/sequence of sequences and return a sequence containing distinct values.

ii) Or - Add a DISTINCT clause that prunes out nodes that have the same value. 
Example - the query in G.5 with a distinct clause - 

  for $p in .
  distinct-values on $p//product, $p//size, $p//color
  return
      <option>
        <product>{$p//product}</product>
        <size>{$s//size}</size>
        <color>{$c//color}</color>
      </option>

 The clause can remove nodes that have the same value for product, size and color and return some $p that has a distinct set of values.

- Steve B.
Received on Friday, 20 February 2004 13:07:41 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:18 UTC