Re: question about a select
От | Cindy |
---|---|
Тема | Re: question about a select |
Дата | |
Msg-id | 9118.1065735764@stephanus.tlg.uci.edu обсуждение исходный текст |
Ответ на | Re: question about a select (Stephan Szabo <sszabo@megazone.bigpanda.com>) |
Ответы |
Re: question about a select
|
Список | pgsql-general |
Thanks for the speedy response! Stephan Szabo writes: >On Thu, 9 Oct 2003, Cindy wrote: > > >> Text=# select distinct on (y_level) y_level, byteloc from >> citations_by_level where aid=543 and wid=1 order by byteloc; >> ERROR: SELECT DISTINCT ON expressions must match initial ORDER BY >> expressions > >Maybe something like: > >select y_level from (select distinct on (y_level) y_level, >byteloc from citations_by_level where aid=543 and wid=1) tab order by >byteloc; Hm...this seems to pick out the y_level with the largest byteloc associated with it...I need the y_level with the smallest byteloc and then sorted by that...lemme play this, but any other suggestions also welcomed... (EG, I got: Text=# select y_level, byteloc from (select distinct on (y_level) y_level, byteloc from citations_by_level where aid=543::smallint and wid=1::smallint) tab order by byteloc; y_level | byteloc ---------+--------- 13 | 24017 11 | 36231 8 | 47240 10 | 96777 2 | 285678 5 | 400212 7,8 | 420879 ... but if you look at the raw data (or some of it): ---------+--------- 1 | 29 1 | 84 2 | 423 3 | 827 4 | 1005 5 | 1169 6 | 1530 1 | 1698 2 | 1988 3 | 2284 4 | 2460 5 | 2638 6 | 2924 7 | 3155 8 | 3396 1 | 3673 2 | 4095 3 | 4387 4 | 4699 5 | 4944 6 | 5055 7 | 5406 8 | 5704 9 | 5996 10 | 6349 1 | 6578 2 | 7110 I want 1 | 29 2 | 423 3 | 827 4 | 1005 5 | 1169 6 | 1530 7 | 3155 8 | 3396 9 | 5996 10 | 6349 etc... -- Cindy ctmoore@uci.edu
В списке pgsql-general по дате отправления: