[GENERAL] grouping of query data in xml

2012-01-21 Thread c k
Hi friends, I am working with some xml exporting functionality of our application. I am testing query_to_xml function supported in PostgreSQL 9.1. XML output should be accgroup accgroupid1/accgroupid accgroupnameCOMPANY ACCOUNT/accgroupname docs refaccdocid638168/refaccdocid

Re: [GENERAL] grouping of query data in xml

2012-01-21 Thread David Johnston
From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of c k Sent: Saturday, January 21, 2012 10:23 AM To: pgsql-admin; pgsql-general@postgresql.org Subject: [GENERAL] grouping of query data in xml Hi friends, I am working with some xml exporting

Re: [GENERAL] grouping of query data in xml

2012-01-21 Thread c k
:* [GENERAL] grouping of query data in xml ** ** Hi friends, I am working with some xml exporting functionality of our application. I am testing query_to_xml function supported in PostgreSQL 9.1. XML output should be accgroup accgroupid1/accgroupid accgroupnameCOMPANY

Re: [GENERAL] grouping of query data in xml

2012-01-21 Thread Pavel Stehule
Hello there are others SQL/XML functions - with this function, you can create xml like you need http://www.postgresql.org/docs/9.1/static/functions-xml.html Regards Pavel Stehule 2012/1/21 c k shreeseva.learn...@gmail.com: Hi friends, I am working with some xml exporting functionality of

Re: [GENERAL] grouping of query data in xml

2012-01-21 Thread c k
I have written a query as follows select xmlelement(name accgroup, xmlforest(accgroupid, accgroupname, xmlforest(refaccdocid,d, c) as doc))::xml AS xmldata from (select 'acc group' as accgroup, accgroups.accgroupid, accgroups.accgroupname, 'docs' as doc, act.refaccdocid, sum(act.debit) as d,

Re: [GENERAL] grouping of query data in xml

2012-01-21 Thread Pavel Stehule
2012/1/21 c k shreeseva.learn...@gmail.com: I have written a query as follows select xmlelement(name accgroup, xmlforest(accgroupid, accgroupname, xmlforest(refaccdocid,d, c) as doc))::xml AS xmldata  from (select 'acc group' as accgroup, accgroups.accgroupid, accgroups.accgroupname,  'docs'

Re: [GENERAL] grouping of query data in xml

2012-01-21 Thread c k
It was not intentionally made, but was remaining due to copy-paste from other queries. It is only one occurrence of unnecessary casting. I got the idea about such a query from an oracle pl/sql book. C P Kulkarni On Sat, Jan 21, 2012 at 11:03 PM, Pavel Stehule pavel.steh...@gmail.comwrote: