Re: Grouping Too Closely
От | Thomas F. O'Connell |
---|---|
Тема | Re: Grouping Too Closely |
Дата | |
Msg-id | 62592AAD-20CB-42EC-B599-E1D42D16A7BC@sitening.com обсуждение исходный текст |
Ответ на | Re: Grouping Too Closely ("Greg Sabino Mullane" <greg@turnstep.com>) |
Ответы |
Re: Grouping Too Closely
|
Список | pgsql-sql |
This doesn't give me quite what I'm looking for because I need there to be only one of each possible value of seq2 to be returned for each value of fkey. -- Thomas F. O'Connell Co-Founder, Information Architect Sitening, LLC Strategic Open Source: Open Your i™ http://www.sitening.com/ 110 30th Avenue North, Suite 6 Nashville, TN 37203-6320 615-260-0005 On Jun 24, 2005, at 11:22 PM, Greg Sabino Mullane wrote: >> What I'd like to be able to do is select all records corresponding to >> the minimum value of seq1 for each value of seq2 corresponding to a >> given fkey (with a lower bound on the value of seq2). > > I'm not sure how uid figures in, but would this do what you want?: > > SELECT fkey, uid, seq2, min(seq1) > FROM my_table > WHERE seq2 > 2 > GROUP BY fkey, uid, seq2 > ORDER BY 1,2,3;
В списке pgsql-sql по дате отправления: