Re: Top N within groups?
От | Klint Gore |
---|---|
Тема | Re: Top N within groups? |
Дата | |
Msg-id | 487AE3C4.3000500@une.edu.au обсуждение исходный текст |
Ответ на | Re: Top N within groups? (Martijn van Oosterhout <kleptog@svana.org>) |
Список | pgsql-general |
Martijn van Oosterhout wrote: > On Fri, Jul 11, 2008 at 01:24:28PM +1000, Klint Gore wrote: > > [thinking out loud] > > Can someone familiar with the source for DISTINCT ON comment on how hard > > it would be to add another parameter to return more than one row? > > From a programming point of view, it wouldn't be too hard. However, > deciding what syntax to use is a another question entirely. I think > your suggestion of FOR isn't good (ambiguous syntax, 'for' could be a > column name), but I can't think of a better one. > 'for' is a reserved key word so can't be a column name. http://www.postgresql.org/docs/8.3/interactive/sql-keywords-appendix.html postgres=# create table foo (for int); ERROR: syntax error at or near "for" The worst I think you could get would be select distinct on ("for") for 4 "for" from table4 for update; but even then, I think the parser could work out what you want. klint. -- Klint Gore Database Manager Sheep CRC A.G.B.U. University of New England Armidale NSW 2350 Ph: 02 6773 3789 Fax: 02 6773 3266 EMail: kgore4@une.edu.au
В списке pgsql-general по дате отправления: