Re: [GENERAL] Getting a sample data set.

2011-01-19 Thread Raymond O'Donnell
On 19/01/2011 00:04, Alban Hertroys wrote: On 18 Jan 2011, at 23:03, Raymond O'Donnell wrote: I suppose you meant particular? Yes, definitely. Although I'm sure some would find it peculiar as well :) Actually, "peculiar to" is perfectly correct here, though a bit old-fashioned. According to

Re: [GENERAL] Getting a sample data set.

2011-01-18 Thread Alban Hertroys
On 18 Jan 2011, at 23:03, Raymond O'Donnell wrote: >>> I suppose you meant particular? Yes, definitely. Although I'm sure >>> some would find it peculiar as well :) >> >> Actually, "peculiar to" is perfectly correct here, though a bit >> old-fashioned. According to my dictionary, it originally m

Re: [GENERAL] Getting a sample data set.

2011-01-18 Thread Raymond O'Donnell
On 18/01/2011 19:34, Tom Lane wrote: Alban Hertroys writes: On 18 Jan 2011, at 19:59, James B. Byrne wrote: I can see the motivation for something like DISTINCT ON. I take it that this syntax is peculiar to PostgreSQL?: I suppose you meant particular? Yes, definitely. Although I'm sure som

Re: [GENERAL] Getting a sample data set.

2011-01-18 Thread James B. Byrne
On Tue, January 18, 2011 14:28, Alban Hertroys wrote: > > Nope, but some Googling put me on the right track. It's called a > correlated subquery. Thank you for this. I will delve further. >> I can see the motivation for something like DISTINCT ON. I take >> it that this syntax is peculiar to

Re: [GENERAL] Getting a sample data set.

2011-01-18 Thread Tom Lane
Alban Hertroys writes: > On 18 Jan 2011, at 19:59, James B. Byrne wrote: >> I can see the motivation for something like DISTINCT ON. I take it >> that this syntax is peculiar to PostgreSQL?: > I suppose you meant particular? Yes, definitely. Although I'm sure some would > find it peculiar as we

Re: [GENERAL] Getting a sample data set.

2011-01-18 Thread Alban Hertroys
On 18 Jan 2011, at 19:59, James B. Byrne wrote: > > On Tue, January 18, 2011 13:23, Alban Hertroys wrote: >> >> >> Standard SQL alternatives tend to get complex, using self-joins to >> weed out all the records you don't want (the exact term for such >> joins escapes me right now, that would hel

Re: [GENERAL] Getting a sample data set.

2011-01-18 Thread James B. Byrne
On Tue, January 18, 2011 13:23, Alban Hertroys wrote: > > > Standard SQL alternatives tend to get complex, using self-joins to > weed out all the records you don't want (the exact term for such > joins escapes me right now, that would help with Googling if you're > looking for examples). Would th

Re: [GENERAL] Getting a sample data set.

2011-01-18 Thread Alban Hertroys
On 18 Jan 2011, at 19:02, James B. Byrne wrote: > Given a table "shipments" having a column called "mode" I want to > extract one entire shipment row (all columns) for each distinct > value of mode. Assuming that there are 1700 rows and that there are > just five distinct values in use for mode t

[GENERAL] Getting a sample data set.

2011-01-18 Thread James B. Byrne
I am working with Ruby on Rails and I have stumbled into a situation which turned out to be, surprisingly for me, somewhat involved. Given a table "shipments" having a column called "mode" I want to extract one entire shipment row (all columns) for each distinct value of mode. Assuming that ther