XQuery Statement (Group by)*

*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 UTC