Joins with groupby (No example in W3 Draft)

Houman Khorasani <[email protected]>
Newsgroups gmane.comp.web.query-languages
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.