Re: union with count?
От | Andreas Kretschmer |
---|---|
Тема | Re: union with count? |
Дата | |
Msg-id | 20070328161906.GA17735@KanotixBox обсуждение исходный текст |
Ответ на | Re: union with count? (Gerardo Herzig <gherzig@fmed.uba.ar>) |
Список | pgsql-sql |
Gerardo Herzig <gherzig@fmed.uba.ar> schrieb: > Thanks! But now i have another problem related with count(): > > select page_id, word, word_position, count(page_id) from (select * from > search_word('word1', 'table1') union search_word('word2', 'table2')) foo > group by page_id; > > and gives me "foo.word must appear in GROUP clause or be used in an > aggregate function" > > And i want to group by page_id only, because that is what i need to count. > Tips here? You can't aggregate without grouping the not-aggregated columns. Expand your 'group by' with word and word_position. Andreas -- Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect. (Linus Torvalds) "If I was god, I would recompile penguin with --enable-fly." (unknow) Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°
В списке pgsql-sql по дате отправления: