grouping of query data in xml

From: c k <shreeseva(dot)learning(at)gmail(dot)com>
To: pgsql-admin <pgsql-admin(at)postgresql(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: grouping of query data in xml
Date: 2012-01-21 15:22:34
Message-ID: CAN2Y=uNKurwSBxdEpKDTTORCnfxordBaxc2yaRVn5amtaW-r3w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

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>
<accgroupid>1</accgroupid>
<accgroupname>COMPANY ACCOUNT</accgroupname>
<docs>
<refaccdocid>638168</refaccdocid>
<debit>10000.0000</debit>
<credit>0.0000</credit>
</docs>
<docs>
<refaccdocid>638168</refaccdocid>
<debit>0.0000</debit>
<credit>10000.0000</credit>
</docs>
</accgroup>

but the output is as follows:
<row>
<accgroup>acc group</accgroup>
<accgroupid>1</accgroupid>
<accgroupname>COMPANY ACCOUNT</accgroupname>
<docs>docs</docs>
<refaccdocid>638168</refaccdocid>
<debit>10000.0000</debit>
<credit>0.0000</credit>
</row>

<row>
<accgroup>acc group</accgroup>
<accgroupid>1</accgroupid>
<accgroupname>COMPANY ACCOUNT</accgroupname>
<docs>docs</docs>
<refaccdocid>638168</refaccdocid>
<debit>0.0000</debit>
<credit>10000.0000</credit>
</row>

How can grouping on specific columns can be done in result xml through
using query_to_xml?
I am expecting help from postgresql community as always.

Thanks

CPKulkarni

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message David Johnston 2012-01-21 15:43:56 Re: [GENERAL] grouping of query data in xml
Previous Message Jesper Krogh 2012-01-21 06:33:59 Force explicit transactions on insert / update

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2012-01-21 15:43:56 Re: [GENERAL] grouping of query data in xml
Previous Message tuanhoanganh 2012-01-21 13:40:55 Re: PGbouncer for Windows 2008