XQuery Statement (Group by)*

Houman Khorasani <[email protected]>
Newsgroups gmane.comp.web.query-languages
Message-ID <[email protected]>
*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
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.