Skip site navigation (1) Skip section navigation (2)

Re: [GENERAL] grouping of query data in xml

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: c k <shreeseva(dot)learning(at)gmail(dot)com>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] grouping of query data in xml
Date: 2012-01-21 16:10:24
Message-ID: CAFj8pRBDL=x4tTLpNnRU+u7OMFPmoj8zt-J8+NAzyQrPjD7aZQ@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-adminpgsql-general
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(dot)learning(at)gmail(dot)com>:
> 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
>

In response to

Responses

pgsql-admin by date

Next:From: c kDate: 2012-01-21 17:20:48
Subject: Re: grouping of query data in xml
Previous:From: c kDate: 2012-01-21 15:52:57
Subject: Re: grouping of query data in xml

pgsql-general by date

Next:From: c kDate: 2012-01-21 17:20:48
Subject: Re: grouping of query data in xml
Previous:From: c kDate: 2012-01-21 15:52:57
Subject: Re: grouping of query data in xml

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group