Is this possible? concatenating results from a subquery

Поиск
Список
Период
Сортировка
От Erwin Moller
Тема Is this possible? concatenating results from a subquery
Дата
Msg-id 408677f2$0$563$e4fe514c@news.xs4all.nl
обсуждение исходный текст
Список pgsql-hackers
Hi!

I face the following problem:
2 tables: tblperson and tblnotes
tblperson:
colums: personid (PK), name

tblnotes:
colums: noteid(PK), personid(references tblperson(personid)), note

tblnotes has notes stored written by a person from tblperson identified (FK) 
by its personid.

I make a select on one table with certain criteria and want to have a 
concatenation on a subquery results.
Something like this:

SELECT P.personid, P.name,concat(SELECT N.note FROM tblnotes AS N WHERE (N.personid=P.personid) )     AS
allnotesbythispersonFROM tblperson AS P WHERE (P.personid=34);
 

The concat word I use is pure fantasy.
Is this at all possible?

I know I can easily circumvent te problem by my scriptinglanguage (PHP), but 
that will result in many extra queries.

How do I proceed?

TIA!!

Regards,
Erwin Moller



В списке pgsql-hackers по дате отправления:

Предыдущее
От: vinayj@ncst.ernet.in
Дата:
Сообщение: Is there any method to keep table in memory at startup
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Thread code not vpath-safe