Re: [SQL] Advanced SELECT

2005-03-01 Thread Kai Hessing
Hi, Tom Lane schrieb: > [ experiments... ] This works reliably in 7.4 and up. Before that, > the optimizer didn't make the connection between the sort ordering of > the inner query and that needed by the outer, so it would repeat the > sort step using only key1 and very possibly destroy the key2

Re: [SQL] Advanced SELECT

2005-02-28 Thread Kai Hessing
Richard Huxton schrieb: > Search the mailing-list archives for "custom aggregate concat" and > you'll quickly find an example of how to write your own custom aggregate > (like SUM()). > > Warning - I don't think you can guarantee the order of elements in the > aggregated sectors. Thank you ver

Re: [SQL] Advanced SELECT

2005-02-24 Thread Tom Lane
Richard Huxton writes: > Search the mailing-list archives for "custom aggregate concat" and > you'll quickly find an example of how to write your own custom aggregate > (like SUM()). > Warning - I don't think you can guarantee the order of elements in the > aggregated sectors. In recent PG ve

Re: [SQL] Advanced SELECT

2005-02-24 Thread Richard Huxton
Kai Hessing wrote: The normal clause would look like: SELECT c.companyname, s.sectorname FROM company c, sector s, company_sector cs WHERE cs.cid = c.cid AND cs.sid = s.sid ORDER BY c.companyname; c.companyname | ??? (sectors) ---+ company1 | secto

[SQL] Advanced SELECT

2005-02-23 Thread Kai Hessing
Hi Folks, I hope to have found the right group for my question. I have difficult sql-task. I try to describe it simple: We have a table 'company' with a cid and a table 'sector' with a sid. They are connected m:n via a third table 'company_sector' which contians csid, cid and sid. The normal cl