Joins with groupby (No example in W3 Draft)

Dear Sir,

 

I have right now a hard time to understand grouping in XQuery. I came from
the relational database to XQuery.

 

http://www.w3.org/TR/xquery/#id-grouping has an example about grouping but
just on ONE document. I wonder how this should work on a join.  Is there any
grouping example on a join between two documents?

 

Right now I am trying to use grouping in the following SQL statement:

 

 

SELECT

          wisc_berkeley_tracetime.rID,

          ip,

          min

FROM

          wisc_berkeley_tracelist INNER JOIN wisc_berkeley_tracetime


          ON wisc_berkeley_tracelist.rID = wisc_berkeley_tracetime.rID

WHERE

          (wisc_berkeley_tracetime.ndate = '20000801000000')

          GROUP by wisc_berkeley_tracelist.ip;

 

 

This XQuery statement has no 'group by' on ip yet.  I am aware of
distinct-value but have no idea how to use it in an efficient way on this
query.

 

for $wbtl in doc("wisc_berkeley_tracelist.xml")//row,

    $wbtt in doc("wisc_berkeley_tracetime.xml")//row[dat = '20000801000000'
and rID = $wbtl/rID]

return 

          <ROW>

          { 

                    $wbtt/rID, $wbtl/ip, $wbtt/min

          } 

          </ROW>

 

I appreciate any help,

Houman Khorasani

University of Wisconsin Platteville

 

Received on Tuesday, 15 June 2004 16:48:30 UTC