Bruce Momjian wrote:
>
> Tom Lane wrote:
> > "Greg Sabino Mullane" <[EMAIL PROTECTED]> writes:
> > >> It's the single most useful non-standard SQL feature postgresql has. It
> > >> is thus simultaneously bad (from a portatbility aspect) and brilliant
> > >> (because it's a million times easier and
Tom Lane wrote:
> "Greg Sabino Mullane" <[EMAIL PROTECTED]> writes:
> >> It's the single most useful non-standard SQL feature postgresql has. It
> >> is thus simultaneously bad (from a portatbility aspect) and brilliant
> >> (because it's a million times easier and faster than the alternatives).
>
"Greg Sabino Mullane" <[EMAIL PROTECTED]> writes:
>> It's the single most useful non-standard SQL feature postgresql has. It
>> is thus simultaneously bad (from a portatbility aspect) and brilliant
>> (because it's a million times easier and faster than the alternatives).
> You mean second-most us
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
>> Ragnar, Marc, thanks so much for the help: DISTINCT ON was *exactly*
>> what I needed.
>> It's not a part of any SQL standard I know of, but does the job
>> _wonderfully_.
> It's the single most useful non-standard SQL feature postgresql has. It
On Tue, Dec 12, 2006 at 06:29:07PM +, Tomi N/A wrote:
> Ragnar, Marc, thanks so much for the help: DISTINCT ON was *exactly*
> what I needed.
> It's not a part of any SQL standard I know of, but does the job
> _wonderfully_.
It's the single most useful non-standard SQL feature postgresql has.
Ragnar, Marc, thanks so much for the help: DISTINCT ON was *exactly*
what I needed.
It's not a part of any SQL standard I know of, but does the job _wonderfully_.
Cheers,
t.n.a.
---(end of broadcast)---
TIP 4: Have you searched our list archives?
Seems that a recursive use of "DISTINCT ON" will do it:
create table factories (id int, factory varchar(10), ownerid int);
create table products (id int, product varchar(10), atime int
,factory_id int);
--owner 1 : factory 1
insert into products values(1,'p1',123,1);
insert into products value
On þri, 2006-12-12 at 16:47 +, Tomi N/A wrote:
> Don't really know where to ask this...the general mailing list sounds
> like the closest.
>
> Let's say I have three tables: owner, factory and product with a 1:N
> relationship at each step.
> Assuming that a product has a production date, how
Don't really know where to ask this...the general mailing list sounds
like the closest.
Let's say I have three tables: owner, factory and product with a 1:N
relationship at each step.
Assuming that a product has a production date, how would you go about
returning a factory for every owner, where