W3C home > Mailing lists > Public > www-ql@w3.org > April to June 2004

Joins with groupby (No example in W3 Draft)

From: Houman Khorasani <khorasani@web.de>
Date: Tue, 15 Jun 2004 15:48:22 -0500
To: www-ql@w3.org
Message-id: <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAfshCxJdP4U+9gdmuPWaWCsKAAAAQAAAALcBXHooAV0i1VmofK7ZcgwEAAAAA@web.de>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 22 July 2006 00:10:19 GMT