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

XQuery Statement (Group by)*

From: Houman Khorasani <khorasani@web.de>
Date: Fri, 04 Jun 2004 15:19:03 -0500
To: www-ql@w3.org
Message-id: <01LB6BY8F0TO8XBX2K@uwplatt.edu>

*Sorry I forgot first to subscribe to the list.  Sorry if you receive my
request a second time.  




Hello,

I would like to translate this SQL statement into XQuery.


SELECT
          `dat`, AVG(dlay), SUM(dlay)
FROM
          `wisc_berkeley`
WHERE dat='20000801000000' AND `tick` < 100000
GROUP by dat;


I tried this in this way, but yet I don’t know how to translate the group
by.


for $i in doc('wisc_berkeley.xml')/data/row
where ($i/dat = '20000801000000' and $i/tick < 100000)
return
          <ROW>
                    { $i/dat }
                    <sumDelay>{ sum($i/dlay) }</sumDelay>
                    <avgDelay>{ avg($i/dlay) }</avgDelay>
          </ROW>


Any comments please?
Houman




Received on Friday, 11 June 2004 16:19:19 GMT

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