From: | Florian Henge <florian(dot)henge82(at)web(dot)de> |
---|---|
To: | Thom Brown <thom(at)linux(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: xml output |
Date: | 2010-08-25 08:53:04 |
Message-ID: | 1195095617.80687.1282726384901.JavaMail.fmail@mwmweb080 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
---------------------
Von: Thom Brown
Gesendet: 23.08.2010 14:09:05
An: Florian Henge
Betreff: Re: [NOVICE] xml output
On 23 August 2010 12:33, Florian Henge <[florian(dot)henge82(at)web(dot)de]> wrote:
hi there!
i wanted to ask how to get an xml output from a table like this:
joe
ian
carl
ben
what i have is the following:
SELECT xmlelement(name words,
xmlforest(nachname))
FROM person
SELECT
xmlelement(name words,
xmlforest(nachname))
FROM person
but that gives me this:
joe
ian
carl
ben
thanks in advance!
bye, flo
You need to use xmlagg:
SELECT
xmlelement(name words,
xmlagg(
xmlforest(first_name)
)
)
FROM person
Regards
--
Thom Brown
Registered Linux user: #516935
_________________________________
Hi!
Thanks, that worked perfectly for me, except for one problem.
I have like 20 times the name "Joe" in my table, but want to get it only once in the xml output file.
How can is do this? I tried SELECT DISTINCT but it didn't work.
Thanks in advance!
___________________________________________________________
Neu: WEB.DE De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
Jetzt De-Mail-Adresse reservieren: https://produkte.web.de/go/demail02
From | Date | Subject | |
---|---|---|---|
Next Message | Thom Brown | 2010-08-25 09:05:56 | Re: xml output |
Previous Message | hubert depesz lubaczewski | 2010-08-24 11:37:55 | Re: select from pipe-delimited field |