Re: [GENERAL] how to create aggregate xml document in 8.3?

2007-12-11 Thread Matt Magoffin
> "Matt Magoffin" <[EMAIL PROTECTED]> writes: >> Thanks very much, that helps. Now I'm wondering if it's also possible to >> then fill in another nested element level in the XML output, from the >> rows >> that are aggregated into the count. > > Something involving xmlagg in the sub-query, perhaps

Re: [GENERAL] how to create aggregate xml document in 8.3?

2007-12-11 Thread Tom Lane
"Matt Magoffin" <[EMAIL PROTECTED]> writes: > Thanks very much, that helps. Now I'm wondering if it's also possible to > then fill in another nested element level in the XML output, from the rows > that are aggregated into the count. Something involving xmlagg in the sub-query, perhaps? No time

Re: [GENERAL] how to create aggregate xml document in 8.3?

2007-12-11 Thread Matt Magoffin
> "Matt Magoffin" <[EMAIL PROTECTED]> writes: >> Hello, I'm trying to write a query to return an XML document like >> >> >> >> ... >> > > Something like this: > > regression=# select xmlelement(name root, xmlagg(x)) from > regression-# (select xmlelement(name range, xmlattributes(string

Re: [GENERAL] how to create aggregate xml document in 8.3?

2007-12-11 Thread Tom Lane
"Matt Magoffin" <[EMAIL PROTECTED]> writes: > Hello, I'm trying to write a query to return an XML document like > > > > ... > Something like this: regression=# select xmlelement(name root, xmlagg(x)) from regression-# (select xmlelement(name range, xmlattributes(string4, count(*) as

[GENERAL] how to create aggregate xml document in 8.3?

2007-12-10 Thread Matt Magoffin
Hello, I'm trying to write a query to return an XML document like ... I started with select xmlelement(name range, xmlattributes(m.range, count(s.id) as "count")) from mb_sale s inner join mb_lead m on m.sale_id = s.id where s.sale_date >= date('2007-08-01') and s.sale_date <=